Question: QUESTION 11 Study the following code and select ALL correct statements about the program. public class Test { public static void main(String[]args) { try {
QUESTION 11 Study the following code and select ALL correct statements about the program. public class Test { public static void main(String[]args) { try { m(); } catch(Exception e) { System.out.println("Caught error."); } finally { System.out.println("Done."); } } public static void m() throws java.io.FileNotFoundException { } } 1. When the program runs, it prints "Caught error.", followed by "Done.". 2. When the program runs, it prints "Caught error." only. 3. Since m() throws a checked exception and main() does not declare any exception, it is necessary to put the call to m() in a try block and use a catch clause to process checked exception, as done in the program. 4. The program does not compile because java.io.FileNotFoundException cannot be resolved to type. 5. When the program runs, it prints "Done." only.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
