Question: Suppose that the setRadius method throws the InvalidRadiusException defined in Listing 1 2 . 1 0 . What is displayed when running the following program?

Suppose that the setRadius method throws the InvalidRadiusException defined in Listing 12.10. What is displayed when running the following program? public class Test { public static void main(String[] args){ try { method(); System.out.println("After the method call"); } catch (RuntimeException ex){ System.out.println("RuntimeException in main"); }
catch (Exception ex){ System.out.println("Exception in main"); } } static void method() throws Exception { try { Circle c1= new Circle(1); c1.setRadius(1); System.out.println(c1.getRadius()); } catch (RuntimeException ex){ System.out.println("RuntimeException in method()"); } catch (Exception ex){ System.out.println("Exception in method()"); throw ex; } } }

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!