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");
}
}
static void p() {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException
int i = 0;
int y = 2 / i;
System.out.println("Welcome to Java");
}
}```
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.
a It should be A. 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.
You might also like to view...
In a UMA multiprocessor, __________.
a) shared virtual memory presents the illusion of shared physical memory, although physical memory is not shared. b) memory access time for a given processor varies depending on which memory module contains the requested data item. c) memory is viewed as a cache so that data can be migrated at the granularity of a memory line, causing a lower percentage of cache misses to be serviced remotely. d) memory access time is nearly the same for all requested data items in main memory.
With ____ compression, an image retains its quality.
A. lossy B. squeezy C. lossless D. resizing
?Add-ins are small programs in Word that allow you to access information on the web without leaving Word.
Answer the following statement true (T) or false (F)
A smartphone may offer cellular and ____ capabilities, which allow a user to connect to the Internet.
A. Wi-Fi B. asymmetrical C. backbone D. integration