Question: import java.io . * ; public class ExceptionExample 1 { static BufferedReader keyboard = new BufferedReader ( new InputStreamReader ( System . in ) )

import java.io.*;
public class ExceptionExample1
{
static BufferedReader keyboard=new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args){
int dividend, divisor, quotient;
try
{
System.out.print(Enter dividend: );
System.out.flush();
dividend = Integer.parseInt(keyboard.readLine());
System.out.println();
System.out.print(Enter divisor: );
System.out.flush();
divisor = Integer.parseInt(keyboard.readLine());
System.out.println();
quotient=dividend/divisor;
System.out.println(quotient =+quotient);
}
catch(ArithmeticException aeRef)
{
System.out.println(Exception+ aeRef.toString());
}
catch(NumberFormatException nfeRef)
{
System.out.println(Exception + nfeRef.toString());
}
catch(IOException ioeRef)
{
System.out.println(Exception +ioeRef.toString());
}
}
}
Which of the following inputs would be caught by the second catch block in the program above?
A.0
B.10
C. h3
D.-1

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!