What is displayed on the console when running the following program?

```
public class Test {
public static void main(String[] args) {
try {
p();
System.out.println("After the method call");
}
catch (NumberFormatException ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
public class Test {
public static void main(String[] args) {
try {
p();
System.out.println("After the method call");
}
catch (NumberFormatException ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
```
a. The program displays NumberFormatException.
b. The program displays NumberFormatException followed by After the method call.
c. The program displays NumberFormatException followed by RuntimeException.
d. The program has a compile error.
e. The program displays RuntimeException.
Key:a It should be A. The main method invokes the method p. In p,


a. The program displays NumberFormatException.
The main method invokes the method p. In p, Integer.parseInt(s) causes a NumberFormatException. The method p is now terminated. The NumberFormatException exception is handled in the main method. So NumberFormatException is displayed.

Computer Science & Information Technology

You might also like to view...

The use of ____ is required to achieve RSN compliance.

A. WPA2 B. CCMP C. TKIP D. EAP

Computer Science & Information Technology

In the accompanying figure of a Microsoft Access 2016 navigation bar, which of the following is Box 1 pointing to?? ?

A. ?Next record button B. ?Previous record button C. ?First record button D. ?Last record button

Computer Science & Information Technology

You can use a named range instead of a cell address in a formula.

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

Computer Science & Information Technology

If your UPS kicks in too often, install a(n) ____________________ to track the voltage over time.

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

Computer Science & Information Technology