Advertisements
Advertisements
प्रश्न
What is the difference between the Scanner class functions next () and nextLine()?
फरक स्पष्ट करा
टीपा लिहा
उत्तर
next ( ) can read the input only till space. It cannot read two words separated by space.
Also, next( ) places the cursor in the same line after reading the input.
nextLine( ) reads input including space between the words (that is, it reads till the end of line \n). Once the input is read, nextLine( ) positions the cursor in the next line.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
APPEARS IN
संबंधित प्रश्न
Name the keyword which: indicates that a method has no return type.
Name the keyword which: makes the variable as a class variable.
Evaluate the following expression if the value of x = 2,y = 3 and z = 1.
v = x + – z + y + + + y.
System.out.print("BEST ");
System.out.println("OF LUCK");
Choose the correct option for the output of the above statements.