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 (RuntimeException ex) {
System.out.println("RuntimeException");
}
catch (Exception ex) {
System.out.println("Exception");
}
}

static void p() throws Exception {
try {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException

int i = 0;
int y = 2 / i;
System.out.println("Welcome to Java");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
catch (Exception ex) {
System.out.println("Exception");
}
}
}```
a. The program displays RuntimeException twice.
b. The program displays Exception twice.
c. The program displays RuntimeException followed by After the method call.
d. The program displays Exception followed by RuntimeException.
e. The program has a compile error.

c

Computer Science & Information Technology

You might also like to view...

If you set the ________ or No changes (Read only) restrictions, you can specify user exceptions for a document

A) Fillin in Forms B) Comments C) Tracked Change D) Styles

Computer Science & Information Technology

Which of the following is not fault-tolerant?

a. RAID Level 0 b. RAID Level 1 c. RAID-5 d. None of the above

Computer Science & Information Technology