Java Scanner hasNextLine() MethodThe hasNextLine() is a method of Java Scanner class which is used to check if there is another line in the input of this scanner. It returns true if it finds another line, otherwise returns false. SyntaxFollowing is the declaration of hasNextLine() method: ParameterThis method does not accept any parameter. ReturnsThe hasNextLine() method returns true if and only if this scanner has another line of input. ExceptionsIllegalStateException Compatibility VersionJava 1.5 and above Example 1Output: Facebook.com true 1 + 1 = 2.0 true JavaTpoint.com false Example 2Output: 3 RV3280 RV2888C 2 RV3280 RV2502C 3 RV3280 RV1263 3 RV2363 RV3280 Example 3Output: hasNextLine public boolean hasNextLine() Next TopicJava-scanner-hasnextlong-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India