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 will cause the first exception to occur in the code in the accompanying figure?
A) If the divisor is zero
B) If the dividend is zero
C) If the quotient is zero
D) This code will not compile, so an exception cannot be triggered.
Correct Answer:
Verified
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
Q25: 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)
Q36: To handle window events, you first create
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