Question: Suppose we have the following code: public static void main ( String [ ] a ) { try { int d = 0 ; float

Suppose we have the following code:
public static void main(String[] a){
try {
int d =0;
float f =1/d;
System.out.println("Done with math.");
} catch (ArithmeticException ae){
System.out.println("Arithmetic Exception!");
} catch (Exception ae){
System.out.println("Exception!");
} finally {
System.out.println("try done.");
}
System.out.println("main done.");
}
What will the above program fragment print?
Group of answer choices
Nothing, this will not compile.
Done with math
Arithmetic Exception!
Exception!
try done.
main done.
Arithmetic Exception!
try done.
main done.
Nothing, this program will compile but will not run.
Arithmetic Exception!
Exception!
try done.
main done.

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!