Question: mport java.util.Scanner; public class DivisionMistakeCaught { public static void main ( String [ ] args ) { Scanner input = new Scanner ( System .
mport java.util.Scanner;
public class DivisionMistakeCaught
public static void mainString args
Scanner input new ScannerSystemin;
int numerator, denominator, result;
Systemout.printEnter numerator ;
numerator input.nextInt;
Systemout.printEnter denominator ;
denominator input.nextInt;
try
result numerator denominator;
Systemout.printlnWorked fine;
return;
catch ArithmeticException mistake
Systemout.printlnArithmetic exception was thrown and caught";
Systemout.printlnEnd of program";
If we enter a nonzero denominator What will be the output of this code?
a This code will print Worked fine and then End of program.
b This code will print Arithmetic exception was thrown and caught first and then End of program.
c This code will only print End of program.
d This code will only print Worked fine.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
