Multiple Choice
int number;
Boolean done = false;do
{
Try
{
System.out.print("Enter an integer: ") ;
Number = console.nextInt() ;
System.out.println() ;
Done = true;
System.out.println("number = " + number) ;
}
Catch (InputMismatchException imeRef)
{
Str = console.next() ;
System.out.println("Exception "
+ imeRef.toString()
+ " " + str) ;
}
}
While (!done) ;How many times will the code in the try block in the accompanying figure execute?
A) Until the user specifies that he/she wants to quit the program
B) Until the user inputs a valid integer
C) If there is an exception thrown, it will execute just once because the program will terminate at that point.
D) Zero times; the program will terminate before it reaches the try block.
Correct Answer:

Verified
Correct Answer:
Verified
Q3: NoSuchElementException is a method of the class
Q10: A checked exception is any exception checked
Q14: Statements that might generate an exception are
Q24: int number;<br>Boolean done = false;do<br>{<br>Try<br>{<br>System.out.print("Enter an integer:
Q25: An unchecked exception is any exception that
Q32: The class RuntimeException is the superclass of
Q33: When an exception occurs, an object of
Q34: import java.util.*;<br>Public class ExceptionExample1<br>{<br>Static Scanner console =
Q35: How many finally blocks can there be
Q47: The class Exception contains two constructors.