This topic contains a solution. Click here to go to the answer

Author Question: What is displayed on the console when running the following program?class Test { public static void ... (Read 24 times)

burchfield96

  • Hero Member
  • *****
  • Posts: 610
What is displayed on the console when running the following program?

class Test {
public static void main(String[] args) {
try {
method();
System.out.println("After the method call");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
catch (Exception ex) {
System.out.println("Exception");
}
}

static void method() throws Exception {
try {
String s = "5.6";
Integer.parseInt(s); // Cause a NumberFormatException
int i = 0;
int y = 2 / i;
System.out.println("Welcome to Java");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
catch (Exception ex) {
System.out.println("Exception");
}
}
}

◦ The program displays RuntimeException followed by After the method call.
◦ The program has a compilation error.
◦ The program displays Exception twice.
◦ The program displays Exception followed by RuntimeException.
◦ The program displays RuntimeException twice.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by burchfield96 on May 6, 2020

kthug

  • Sr. Member
  • ****
  • Posts: 332
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




burchfield96

  • Member
  • Posts: 610
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


xiaomengxian

  • Member
  • Posts: 311
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

The Centers for Disease Control and Prevention has released reports detailing the deaths of infants (younger than 1 year of age) who died after being given cold and cough medications. This underscores the importance of educating parents that children younger than 2 years of age should never be given over-the-counter cold and cough medications without consulting their physicians.

Did you know?

Cytomegalovirus affects nearly the same amount of newborns every year as Down syndrome.

Did you know?

Certain rare plants containing cyanide include apricot pits and a type of potato called cassava. Fortunately, only chronic or massive ingestion of any of these plants can lead to serious poisoning.

Did you know?

Famous people who died from poisoning or drug overdose include, Adolf Hitler, Socrates, Juan Ponce de Leon, Marilyn Monroe, Judy Garland, and John Belushi.

Did you know?

Allergies play a major part in the health of children. The most prevalent childhood allergies are milk, egg, soy, wheat, peanuts, tree nuts, and seafood.

For a complete list of videos, visit our video library