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 catch (RuntimeException ex) should be specified before catch (Exception ex).

Computer Science & Information Technology

You might also like to view...

After you have pressed the Enter key, you cannot edit the value entered into the cell.

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

Computer Science & Information Technology

On a typical x86 computer, what size is a single data page?

A. 4KB B. 8KB C. 16KB D. 32KB

Computer Science & Information Technology

A(n) ________ file might contain audience handouts and speaker notes in addition to electronic slides.

A. worksheet B. presentation C. OneNote D. database

Computer Science & Information Technology

Julia encrypts a message to David using public key encryption for confidentiality. After encrypting the message, can Julia decrypt it?

True False

Computer Science & Information Technology