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 35 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
Great answer, keep it coming :)


dantucker

  • Member
  • Posts: 346
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Asthma attacks and symptoms usually get started by specific triggers (such as viruses, allergies, gases, and air particles). You should talk to your doctor about these triggers and find ways to avoid or get rid of them.

Did you know?

Despite claims by manufacturers, the supplement known as Ginkgo biloba was shown in a study of more than 3,000 participants to be ineffective in reducing development of dementia and Alzheimer’s disease in older people.

Did you know?

Asthma is the most common chronic childhood disease in the world. Most children who develop asthma have symptoms before they are 5 years old.

Did you know?

The strongest synthetic topical retinoid drug available, tazarotene, is used to treat sun-damaged skin, acne, and psoriasis.

Did you know?

Children with strabismus (crossed eyes) can be treated. They are not able to outgrow this condition on their own, but with help, it can be more easily corrected at a younger age. It is important for infants to have eye examinations as early as possible in their development and then another at age 2 years.

For a complete list of videos, visit our video library