What is the output of the following application?
package mypkg; //from w ww .ja v a 2s. c o m class Exception1 implements RuntimeException {} public class Main extends Exception1 { public static void main(String uhOh[]) { try { throw new Main(); } catch (Main re) { System.out.print("Exception1?"); } catch (Exception1 e) { System.out.print("Handled"); } finally { System.out.print("Fixed!"); } } }
D.
The class RuntimeException is not an interface and it cannot be implemented.
The Exception1 class does not compile, and Option D is the correct answer.
This is the only compilation problem in the application.
If implements was changed to extends, the code would compile and Exception1?Fixed! would be printed, making Option A the correct answer.