Multiple Choice
Select the missing expression in the code fragment below. The method should continue to prompt the user for a valid integer value until one is entered. The method returns the final value entered. public static int getAge()
{
Boolean done = false;
Scanner console = new Scanner(System.in) ;
Int value = 0;
While (!done)
{
Try
{
System.out.print("Please enter your age in years: ") ;
Value = console.nextInt() ;
Done = true;
}
______________________
{
System.out.println("Invalid value. Try again.") ;
Console.nextLine() ;
}
}
Return value;
}
A) finally
B) catch (IllegalArgumentException exception)
C) catch (NoSuchElementException exception)
D) catch (NumberFormatException exception)
Correct Answer:

Verified
Correct Answer:
Verified
Q15: Which of the following statements about checked
Q75: Insert the missing code in the following
Q76: Consider the following code snippet: public double[]
Q77: Insert the missing code in the following
Q78: Consider the following code snippet: Scanner in
Q79: Which of the following statements about a
Q81: Consider the following code snippet: PrintWriter outputFile
Q82: Which of the following statements about the
Q83: Consider the following code snippet: File inputFile
Q85: Which of the following statements about reading