Examlex

Solved

Select the Missing Expression in the Code Fragment Below

question 80

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;
}


Definitions:

Related Questions