KnowledgeBoat Logo
|

Computer Applications

The Scanner class method used to accept words with space:

  1. next()
  2. nextLine()
  3. Next()
  4. nextString()

Input in Java

ICSE 2023

24 Likes

Answer

nextLine()

Reason — nextLine() reads the input till the end of line so it can read a full sentence including spaces.

Answered By

14 Likes


Related Questions