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.


Answer: B

Computer Science & Information Technology

You might also like to view...

How can you protect critical code?

What will be an ideal response?

Computer Science & Information Technology

A broadcast ____ is a condition in which so many broadcasts are sent at the same time that the network bandwidth is saturated and the network slows significantly or times out.

A. chain B. storm C. flood D. packet

Computer Science & Information Technology

Identify UDP Header Fields and Operation Using a Wireshark TFTP Session Capture

Use Wireshark to capture a TFTP session and inspect the UDP header fields.

Computer Science & Information Technology

Briefly describe the main characteristics of the rational unified process (RUP)?

What will be an ideal response?

Computer Science & Information Technology