5.9) Does the order of the exceptions caught in the catch blocks matter?


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class CaseBaseExceptionBeforeDerived {
	public static void main(String[] args) {
		FileInputStream fis = null;
		try {
			fis = new FileInputStream("file.txt");
			fis.close();
		} catch (IOException ioe) {
			System.out.println("IOException");
		} catch (FileNotFoundException fnfe) {
			System.out.println("File not found");
		}
	}
}



Previous5.8) Can a try block be followed only by a finally block?Next5.10) Can I rethrow an exception or the error I catch?
Last updated
Was this helpful?
