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)

captainjonesify

  • Hero Member
  • *****
  • Posts: 543
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 (NumberFormatException ex) {
System.out.println("NumberFormatException");
throw ex;
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
}

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


Related Topics

Need homework help now?

Ask unlimited questions for free

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

firehawk60

  • Sr. Member
  • ****
  • Posts: 315
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




captainjonesify

  • Member
  • Posts: 543
Reply 2 on: May 6, 2020
Thanks for the timely response, appreciate it


Liamb2179

  • Member
  • Posts: 365
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

Oliver Wendell Holmes is credited with introducing the words "anesthesia" and "anesthetic" into the English language in 1846.

Did you know?

Today, nearly 8 out of 10 pregnant women living with HIV (about 1.1 million), receive antiretrovirals.

Did you know?

Your chance of developing a kidney stone is 1 in 10. In recent years, approximately 3.7 million people in the United States were diagnosed with a kidney disease.

Did you know?

The ratio of hydrogen atoms to oxygen in water (H2O) is 2:1.

Did you know?

Not getting enough sleep can greatly weaken the immune system. Lack of sleep makes you more likely to catch a cold, or more difficult to fight off an infection.

For a complete list of videos, visit our video library