Question: public class CallStack{ // Called by func1() void func2 (){ System.out.println(In func2 method); int a = 0; int b; b = 10 / a; }

public class CallStack{
// Called by func1() void func2 (){ System.out.println("In func2 method"); int a = 0; int b; b = 10 / a; }
//Called by Main void func1(){ System.out.println("In func1 method"); this.func2 (); System.out.println("Back in func1 method");
}
public static void main (String args[]){ CallStack myCallStack; myCallStack = new CallStack(); System.out.println("In the main method"); myCallStack.func1 ();
} }
Handling exceptions a. Download the following file from the class website: CallStack.java b. Examine the code to determine What it does. c. Compile and execute the code. d. Modify the main0 method to handle the exception that is propagated to it. Use a try catch block to display a meaningful error message when the exception occurs e. Test your code. Notice that, although the exception was thrown in func2, it is caught by the catch block in the main method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
