Expert View 💬
These questions are designed to strengthen the understanding of how Java handles input and output through
streams and files. In interviews at TCS, Infosys, or Wipro, fundamental I/O concepts are often tested to
gauge how comfortable a candidate is with real-world data handling and resource management.
Top 20 Basic Java I/O Interview Questions (Hover to See Answers)
1. What is meant by Java I/O?
2. What is a Stream in Java?
3. Differentiate between Byte Stream and Character Stream.
4. What are InputStream and OutputStream used for?
5. What are FileInputStream and FileOutputStream?
6. What are FileReader and FileWriter used for?
7. Explain the use of BufferedReader and BufferedWriter.
8. What is the purpose of the File class?
9. How do you create and delete a file in Java?
10. What are DataInputStream and DataOutputStream?
11. What are BufferedInputStream and BufferedOutputStream used for?
12. What is the use of the flush() method in OutputStream?
13. What are ObjectInputStream and ObjectOutputStream used for?
14. Differentiate between IOException and FileNotFoundException.
15. What is Automatic Resource Management (ARM) in Java?
16. Give an example of ARM in Java.
17. Why is closing a stream important?
18. How can you read console input in Java using Scanner?
19. What is the PrintWriter class used for?
20. What is the purpose of Path and Files in Java NIO.2?