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, 24.06.2019 11:00
Need fast im timed in a paragraph of 125 words, explain at least three ways that engineers explore possible solutions in their projects.
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Create a file called favorite_foods, and list your favorite foods, entering five or six or more. press enter after each favorite food so it appears on its own line (make certain you also press enter after the final food item). after the file is created, add two more foods you like that are not on the list (press enter after the final food item). view the list of foods to make certain the two items you added appear at the end of the list
Answers: 2
You know the right answer?
What is displayed on the console when running the following program?

public class Test {...
Questions
question
Mathematics, 03.09.2020 17:01
Questions on the website: 13722361