Question: class May { public int m; public May ( int value ) { m = value; System.out.println ( constructed . . . )

class May { public int m; public May(int value){ m = value; System.out.println("constructed..."); } public void summer(int start, int end){ for (int i =0; i < end; i++){ if (i > m){ System.out.println(i); throw new RuntimeException(); }}} public static void main(String[] args){ May x = new May(16); try { System.out.println("About to invoke summer..."); x.summer(10,20); System.out.println("Invoked summer..."); } catch (RuntimeException e){ System.out.println("Caught an exception!"); }}}

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 Programming Questions!