Back to Browse

CP-1.004 Java Tutorial - Scanner .next() and .nextLine()

808 views
Sep 9, 2021
10:29

Problem: Quick Estimates (https://open.kattis.com/problems/quickestimate) In Java, you need to be careful when using Scanner's .next() (or .nextInt(), etc) with .nextLine(), and this video explains why. The problem itself is trivial and I'm only using it to explain what's going on with .next() and .nextLine() when used together. Please see https://www.youtube.com/watch?v=2vi1o0Fr0Uk for the start of this video series. 0:00 - Intro 1:05 - First solution 3:13 - Second solution 5:09 - The problem with next() and nextLine() 8:39 - Using nextLine() to read the extra newline character Please note that all views and opinions expressed in this video are my own and does not reflect that of Kattis or any other person/organisation mentioned in the video.

Download

0 formats

No download links available.

CP-1.004 Java Tutorial - Scanner .next() and .nextLine() | NatokHD