Question
2. Provide the output of the following program for the values of y=0 and y=2: public class Test { public static void main(String args[]) {
2. Provide the output of the following program for the values of y=0 and y=2: public class Test { public static void main(String args[]) { try { System.out.println("calling method a"); a(); System.out.println("return from method a"); } catch(ArithmeticException e) { System.out.println("main: catch"); } finally { System.out.println("main: finally"); } } public static void a() { try { int x=8,y=0; int z=x/y; System.out.println("value of z="+z); } catch(NumberFormatException e) { System.out.println("method a:catch"); } finally { System.out.println("method a:finally"); } }}
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