Question: Question 2 [5 marks] Given this class: class MTException extends Exception { } What is the output of the following program? class MT2Q2 { public

 Question 2 [5 marks] Given this class: class MTException extends Exception

Question 2 [5 marks] Given this class: class MTException extends Exception { } What is the output of the following program? class MT2Q2 { public static void bar (int x) throws, MTException { System.out.println("Q"); if (x > 2) { throw new MTException(); } System.out.println("S"); } public static void foo (int x) throws MTException { System.out.println("T"); bar(); System.out.println("A"); } public static void main (String[] args) { try { System.out.println("D"); foo(8), System.out.println("F"); } catch (MTException e) { System.out.println(""); } System.out.println(""); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!