Calling Superclass Constructors
Consider the following class hierarchy.
public class Student
{
private int gradYear;
private double gpa;
/* implementation not shown */
}
public class UnderClassman extends Student
{
private int homeRoomNum;
private String counselor;
/* implementation not shown */
}
public class Freshman extends UnderClassman
{
private int middleSchoolCode;
/* implementation not shown */
}
Assume that the constructors for these classes have the following signatures.
public Student(int gradYear, double gpa)
public UnderClassman(int gradYear, double gpa, int homeRoomNum, String counselor)
public Freshman(int gradYear, double gpa, int homeRoomNum, String counselor, int middleSchoolCode)
Which of the following shows the correct call to the superclass constructor that would appear in the body of the Freshman constructor?
A
super(homeRoomNum, counselor);
B
super(gradYear, gpa, homeRoomNum, counselor, middleSchoolCode);
C
super(gradYear, gpa, homeRoomNum, counselor);
D
super();
Question Leaderboard
Not enough data yet to show leaderboard.
