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 23 times)

yoooooman

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

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

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


Related Topics

Need homework help now?

Ask unlimited questions for free

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

olivia_paige29

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




yoooooman

  • Member
  • Posts: 557
Reply 2 on: May 6, 2020
Excellent


vickybb89

  • Member
  • Posts: 347
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

When Gabriel Fahrenheit invented the first mercury thermometer, he called "zero degrees" the lowest temperature he was able to attain with a mixture of ice and salt. For the upper point of his scale, he used 96°, which he measured as normal human body temperature (we know it to be 98.6° today because of more accurate thermometers).

Did you know?

Signs of depression include feeling sad most of the time for 2 weeks or longer; loss of interest in things normally enjoyed; lack of energy; sleep and appetite disturbances; weight changes; feelings of hopelessness, helplessness, or worthlessness; an inability to make decisions; and thoughts of death and suicide.

Did you know?

Excessive alcohol use costs the country approximately $235 billion every year.

Did you know?

Stevens-Johnson syndrome and Toxic Epidermal Necrolysis syndrome are life-threatening reactions that can result in death. Complications include permanent blindness, dry-eye syndrome, lung damage, photophobia, asthma, chronic obstructive pulmonary disease, permanent loss of nail beds, scarring of mucous membranes, arthritis, and chronic fatigue syndrome. Many patients' pores scar shut, causing them to retain heat.

Did you know?

Approximately 25% of all reported medication errors result from some kind of name confusion.

For a complete list of videos, visit our video library