Java - Exceptions - Interview Questions and Answers on IOException

Q1.  What are the sub classes of Exception class?

Ans. The Exception class has two main subclasses : IOException class and RuntimeException Class.

Q2.  Which exception should be handled in the following code ?

File file = new File("../file.txt");
FileWriter fileWriter = new FileWriter(file);

Ans. IOException

Q3. What is the package name for IOException class?

Ans.java.io

Q4. Which interfaces are implemented by IOException?

Ans.[Serializable]

Q5. Which is the Parent Class of IOException class?

Ans.Exception