Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is the purpose of the Scanner class in Java?
Think about user input.
How do you import the Scanner class?
Look for the keyword 'import.'
What command do you use to import the Scanner class?
Look for the import keyword.
True or False: The Scanner class is used for output in Java.
Think about input/output functions.
Create a Java program that imports the Scanner class, reads two integers from the user, and prints their sum.
Remember to import, create Scanner, and use nextInt.
Explain what happens if the Scanner is not closed after use, and modify the previous example to include the closing of the Scanner.
Think about managing resources after usage.
3 more questions in this section. Enroll free to practise them all.
Enroll free