import java.util.*;
Public class ExceptionExample1
{
Static Scanner console = new Scanner(System.in) ; public static void main(String[] args)
{
Int dividend, divisor, quotient; try
{
System.out.print("Enter dividend: ") ;
Dividend = console.nextInt() ;
System.out.println() ;
System.out.print("Enter divisor: ") ;
Divisor = console.nextInt() ;
System.out.println() ;
Quotient = dividend / divisor;
System.out.println("quotient = " + quotient) ;
}
Catch (ArithmeticException aeRef)
{
System.out.println("Exception" + aeRef.toString() ) ;
}
Catch (InputMismatchException imeRef)
{
System.out.println("Exception "
+ imeRef.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 in the accompanying figure?
A) 0
B) 10
C) h3
D) -1
Correct Answer:
Verified
Q9: If you have a reference to an
Q21: An exception that can be recognized by
Q22: The class RuntimeException is the superclass of
Q23: If you have created an exception class,
Q24: Which of the following is NOT a
Q26: import java.util.*;
Public class ExceptionExample1
{
Static Scanner console =
Q29: What can a method do with a
Q30: import java.util.*;
Public class ExceptionExample1
{
Static Scanner console =
Q31: Which of the following statements is true?
A)
Q38: If a negative value is used for
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents