57.3k views
1 vote
Public class Student {

private String getFood() {
return "Pizza";
}
public String getInfo() {
return this.getFood();
}
}
public class GradStudent extends Student {
private String getFood() {
return "Taco";
}
public void teach(){
System.out.println("Education!");
getInfo();
}
}
What is the output from this:

Student s1 = new GradStudent();
s1.teach();
Education! would be printed, followed by a run-time error when getInfo is called.

Education! Pizza

This code won't run because it won't compile.

Education! Taco

This code causes a run-time error because getInfo is not declared in the GradStudent class.

User Kvn CF
by
6.0k points

1 Answer

2 votes

Answer:

getInfo(); ==

getSy.Info()

Step-by-step explanation:

Get System Info

User LucasBoatwright
by
6.4k points