Java Scanner Class Aptitude Questions and Answers.

This section contains Aptitude Questions and Answers on Java Scanner Class, method of Scanner Class are used to read values from the user.

List of Java Scanner Class Aptitude Questions

1) Which Scanner class method is used to read integer value from the user?
  1. next()
  2. nextInteger()
  3. nextInt()
  4. readInt()

2) Which Scanner class method is used to read string value from the user?
  1. next()
  2. nextString()
  3. nextLine()
  4. Both 1 and 3

3) Which method does not store string value after space?
  1. next()
  2. nextString()
  3. nextLine()
  4. Both 1 and 3

4) Which is the correct syntax to declare Scanner class object?
  1. Scanner objectName= Scanner();
  2. Scanner objectName= new Scanner();
  3. Scanner objectName= Scanner(System.in);
  4. Scanner objectName= new Scanner(System.in);

5) Consider the following object declaration statement
Scanner objectName= new Scanner(System.in);
What is System.in in this declaration?
  1. Class which point input device
  2. Reference to Input stream
  3. Reference to Computer System
  4. None of these











Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.



Comments and Discussions


We are using Google to publish ads on our website; Google has its own privacy policies. They may save log, cookies on your system. Google may also collect information of your system like IP address, region, city, country. For more details please go through the Google’s privacy policy.