Question: 1 6 - The following class declarations are given. What is the output of the following code segment. Student s 1 = new GradStudent (
The following class declarations are given. What is the output of the following code segment.
Student s new GradStudent; sgetInfo;
public class student
public String getFood
return "Pizza";
public string getinfo
return this.getFood;
public class Gradstudent extends Student
public string getFood
return "Taco";
a Won't compile since you use this.getFood
b Won't compile since you are creating a GradStudent, not a Student
c Taco
d Pizza
e Won't compile since GradStudent doesn't have a getInfo method
Leave blank
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
