Computer Applications
Distinguish between the following:
next() and hasNext()
Input in Java
24 Likes
Answer
next() | hasNext() |
---|---|
It reads the input till the next complete token until the delimiter is encountered. | It checks if the Scanner has another token in its input. |
It returns a String value. | It returns a boolean value. |
Answered By
15 Likes
Related Questions
Distinguish between the following:
hasNext() and hasNextLine()
Distinguish between the following:
next() and nextLine()
Distinguish between the following:
next() and next().charAt(0)
Consider the following input:
one, two three, four, fiveWhat values will the following code assign to the variables input1 and input2?
String input1 = keyboard.next();
String input2 = keyboard.next();