English

The Scanner class method used to accept words with spаce:

Advertisements
Advertisements

Question

The Scanner class method used to accept words with spаce:

Options

  • next()

  • nextLine()

  • Next()

  • nextString()

MCQ
Advertisements

Solution

nextLine()

Explanation:

The nextLine() method reads the entire input string, including spaces, until it hits the end of the line (when Enter is pressed). In contrast, the standard next() method stops reading at the very first space it encounters.

shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Library Classes - Exercises [Page 134]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 5 Library Classes
Exercises | Q 1. (xi) | Page 134
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×