Answered step by step
Verified Expert Solution
Question
1 Approved Answer
y you just added. Now add a try-block m1 () should now look like this (the new parts are shown in bold text): public static
y you just added. Now add a try-block m1 () should now look like this (the new parts are shown in bold text): public static void m1 (int t ) \{ System.out.print7n("Top of m1; try \{ if (t>10) throw new MyCheckedException (" t is large"); \} catch (MycheckedException e) \{ System. out. println("Error caught"); \} System.out.println("Bottom of m1 ); \} 9. Having a try-catch statement like this removes the compiler-error and does not cause any new compiler-errors in the file. Run the file. You can see that it compiled and ran properly. 10. Change the 5 's to 15 's in the two method calls in main (i.e. m1(15) and m2(15) ) and run it again. 11. Notice that in m1 (), there are 3 lines print out: "Top of m1 ", "Error caught", and "Bottom of m1 ". But in m2( ), there is only 1 line printed out before the exception text (in red font): "Top of m2". Why does "Bottom of m2" not get printed out? Write your answer in AnswersLab6.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started