Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:30, KrishnaBalaram1235
To hide gridline when you display or print a worksheet
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, jumpgirll
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
image
Computers and Technology, 23.06.2019 00:30, lm18618
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
image
Computers and Technology, 23.06.2019 18:30, bsept1018
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
Do you know the correct answer?
What is displayed on the console when running the following program?

public class Test {...

Questions in other subjects:

Konu
Mathematics, 05.02.2021 01:00
Konu
Engineering, 05.02.2021 01:00
Konu
Geography, 05.02.2021 01:00