Question: Given the following code, and assuming execution begins in main(), what is the sequence of events when a NullPointerException is thrown in m30? public class

Given the following code, and assuming execution begins in main(), what is the sequence of events when a NullPointerException is thrown in m30? public class PitchAndCatch { public static void main(String[] args) { try { PitchAndCatch pac = new PitchAndCatch(); pac.m1(); pac.m2; System.out.println("Game on!"); } catch (NullPointerException ae) { } } public void m10 {-} public void m2({ m3; } catch (ArithmeticException ae) { } } public void m3 {-} O a. Exception propagates to m20 -> Exception propagates to main() -> Exception is caught -> program exits without crashing O b. Exception is not caught -> program crashes and prints the stack trace to the console O c. Exception propagates to m20)-> Exception propagates to m10 -> Exception propagates to main() -> Exception is caught -> program exits without crashing d. Exception propagates to m20 -> Exception propagates to main() -> Exception is caught -> "Game on!" is printed to the console-> program exits without crashing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
