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.