Analyze the following code:

```
public class Test {
public static void main(String[] args) {
try {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException

int i = 0;
int y = 2 / i;
}
catch (Exception ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
}
```
a. The program displays NumberFormatException.
b. The program displays RuntimeException.
c. The program displays NumberFormatException followed by RuntimeException.
d. The program has a compile error.


d. The program has a compile error.
catch (RuntimeException ex) should be specified before catch (Exception ex).

Computer Science & Information Technology

You might also like to view...

When creating a flowchart to represent selection structures, you use the rectangular symbol for a condition expression.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A(n) ________ password contains a combination of uppercase and lowercase letters, numbers, and symbols

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which is a suggestion for speakers to keep in mind if they are nervous when facing an audience?

A. Neglect the environment. B. Turn the nervousness into an advantage. C. Use filler words and phrases. D. Do not practice before the presentation.

Computer Science & Information Technology

Once connected to a Web site, the ________ interprets the HTML formatting instructions and displays the Web page

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology