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

Author Question: Given the following code, find the compile error.public class Test { public static void ... (Read 37 times)

Yi-Chen

  • Hero Member
  • *****
  • Posts: 550
Given the following code, find the compile error.

public class Test {
public static void main(String[] args) {
m(new GraduateStudent());
m(new Student());
m(new Person());
m(new Object());
}

public static void m(Student x) {
System.out.println(x.toString());
}
}

class GraduateStudent extends Student {
}

class Student extends Person {
public String toString() {
return "Student";
}
}

class Person extends Object {
public String toString() {
return "Person";
}
}

◦ m(new Person()) causes an error
◦ m(new Student()) causes an error
◦ m(new GraduateStudent()) causes an error
◦ m(new Object()) causes an error


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by Yi-Chen on May 6, 2020

macagnavarro

  • 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 64% of students answer this correctly




Yi-Chen

  • Member
  • Posts: 550
Reply 2 on: May 6, 2020
Wow, this really help


Bigfoot1984

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

 

Did you know?

Human stomach acid is strong enough to dissolve small pieces of metal such as razor blades or staples.

Did you know?

Between 1999 and 2012, American adults with high total cholesterol decreased from 18.3% to 12.9%

Did you know?

The use of salicylates dates back 2,500 years to Hippocrates's recommendation of willow bark (from which a salicylate is derived) as an aid to the pains of childbirth. However, overdosage of salicylates can harm body fluids, electrolytes, the CNS, the GI tract, the ears, the lungs, the blood, the liver, and the kidneys and cause coma or death.

Did you know?

Bisphosphonates were first developed in the nineteenth century. They were first investigated for use in disorders of bone metabolism in the 1960s. They are now used clinically for the treatment of osteoporosis, Paget's disease, bone metastasis, multiple myeloma, and other conditions that feature bone fragility.

Did you know?

In 2006, a generic antinausea drug named ondansetron was approved. It is used to stop nausea and vomiting associated with surgery, chemotherapy, and radiation therapy.

For a complete list of videos, visit our video library