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 45 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


blakcmamba

  • Member
  • Posts: 335
Reply 3 on: Yesterday
Excellent

 

Did you know?

Human kidneys will clean about 1 million gallons of blood in an average lifetime.

Did you know?

The first oral chemotherapy drug for colon cancer was approved by FDA in 2001.

Did you know?

Multiple experimental evidences have confirmed that at the molecular level, cancer is caused by lesions in cellular DNA.

Did you know?

Most strokes are caused when blood clots move to a blood vessel in the brain and block blood flow to that area. Thrombolytic therapy can be used to dissolve the clot quickly. If given within 3 hours of the first stroke symptoms, this therapy can help limit stroke damage and disability.

Did you know?

There are more nerve cells in one human brain than there are stars in the Milky Way.

For a complete list of videos, visit our video library