subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
1. technician a says horsepower information can be used by consumers to compare the power of different automobile engines. technician b says that manufacturers will often list the horsepower output of their engines in the online service information. who is right?
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Experimental data that is expressed using numbers is said to be
Answers: 1
You know the right answer?
What is displayed on the console when running the following program?

public class Test {...
Questions
question
English, 11.11.2020 01:00
question
Mathematics, 11.11.2020 01:00
question
Mathematics, 11.11.2020 01:00