Successful reading

Report a typo

Here is the code that uses the Scanner class:

val scanner = Scanner(System.`in`)
val s1 = scanner.nextLine()
val n = scanner.nextInt()
val s2 = scanner.next()

Which inputs suit this snippet? After reading the input, each variable should have a value. Note, Input: is not a part of input!

Be careful when choosing, remember the difference between methods .nextLine(), .nextInt(), and .next().

Select one or more options from the list
___

Create a free account to access the full topic