What is the Difference Between the Scanner Class Functions Nextq and Nextline()?
Advertisements
प्रश्न
What is the difference between the Scanner class functions next () and nextLine()?
अंतर स्पष्ट करें
टिप्पणी लिखिए
Advertisements
उत्तर
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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
