🧠 Worksheet: Input in Java
📘 Topic: Taking Input using Scanner Class
💻 Class Level: Beginner
🕒 Time: 30 minutes
🔹 Section A — Theory (Answer in short)
1. What is the purpose of the Scanner class in Java?
2. Which package must be imported to use the Scanner class?
3. Write the syntax to create a Scanner object.
4. What is the difference between next() and nextLine()?
5. What happens if you use nextInt() and then nextLine() immediately after?
6. Which method of the Scanner class is used to input a double value?
7. Write the statement to close a Scanner object named sc.
8. Can Scanner read input from files? If yes, how?
9. What kind of exception can occur while using the Scanner class?
10. What does the System.in refer to?