Java Scanner nextLine() Method
The nextLine() method of Java Scanner class is used to get the input string that was skipped of the Scanner object.
Following is the declaration of nextLine() method:
This method does not accept any parameter.
The nextLine() method returns the the line that was skipped.
NoSuchElementException- It will thrown this Exception if no line was found.
IllegalStateException- It will thrown this Exception if the innvocation is done after Scanner is closed.
Java 1.5 and above
Enter Item ID: A151 Enter Item price: 3473.75 Price of Item A151 is $3473.75
hasNextLine public boolean hasNextLine() IllegalStateException
Facebook.com true 1 + 1 = 2.0 true JavaTpoint.com false