2)
Which Scanner class method is used to read string value from the user?
- next()
- nextString()
- nextLine()
- Both 1 and 3
Correct Answer: 4
Both 1 and 3
next() and nextLine() both methods can be used to read string from the user.
3)
Which method does not store string value after space?
- next()
- nextString()
- nextLine()
- Both 1 and 3
Correct Answer: 1
next()
next() method does not store string value after space.
5)
Consider the following object declaration statement
Scanner objectName= new Scanner(System.in);
What is System.in in this declaration?
- Class which point input device
- Reference to Input stream
- Reference to Computer System
- None of these
Correct Answer: 2
Reference to Input Stream