5 Questions
What is the purpose of the Scanner class in Java?
To handle input from the keyboard
Which method of the Scanner class is used to input a string (word)?
next()
What data type does the 'nextBoolean()' method of the Scanner class return?
Boolean
In the given Java program, what does 'x = input.nextInt();' do?
It reads an integer input from the keyboard and stores it in variable x
What is the purpose of the line 'System.out.printf( "The Resul is = " + sum );' in the given Java program?
To print the sum of two numbers with a message to the console
Learn about input statement and the string data type in Java programming. Understand how to use the Scanner class to obtain information typed at the keyboard and the creation of string types with Java string methods.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free