मराठी

What is the Difference Between the Scanner Class Functions Nextq and Nextline()?

Advertisements
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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2016-2017 (March) Set 1
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×