Given the following snippet code:

try
{
someMethod(arr, val);
}
catch (RuntimeException e)
{
System.out.println("Oopsie");
}
Where it is possible that someMethod can throw either a NullPointerException or an IndexOutOfBoundsException, both of which inherit from RuntimeException, what happens when either of these Exceptions occur?

A- The program will terminate because neither NullPointerException or IndexOutOfBoundsException is caught by the try statement
B- There is no way of knowing
C- It will output "Oopsie"
D- This will not compile


Answer; C- It will output "Oopsie"

Computer Science & Information Technology

You might also like to view...

To insert a picture into a presentation, the picture must be saved in a(n) ____________________ that PowerPoint can recognize.

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

Computer Science & Information Technology

A distraction is a communication filter

Indicate whether the statement is true or false

Computer Science & Information Technology

A method involving unauthorized user requests between two parties without either party knowing the communication link has been compromised.

A. Spoofing B. Social engineering C. Spam D. Man in the middle

Computer Science & Information Technology

Joe received a digitally signed message from Grace What cryptographic key should he use to verify that digital signature?

a. Grace's public key b. Grace's private key c. Joe's public key d. Joe's private key

Computer Science & Information Technology