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. The program displays RuntimeException followed by After the method call.

Computer Science & Information Technology

You might also like to view...

Section breaks can be access from which tab?

A) Insert B) View C) Page Layout D) Home

Computer Science & Information Technology

Which of the following are some frequently and commonly used file formats for Excel?

A) MDB B) TXT C) Bitmap or JPEG D) Excel Template, Excel 97-2003 Workbook, CSV or tab delimited

Computer Science & Information Technology