Question: / / Represents a university student. public class Student { private String name; private int age; public Student ( String name, int age ) {
Represents a university student. public class Student private String name; private int age; public Student String name, int age this.name name; this.age age; public void setAge int age this.age age; Also consider the following partial implementation of a subclass of student to represent undergraduate students at a university:public class UndergraduateStudent extends Student private int year; Can the code in the UndergraduateStudent class access the name and age fields it inherits from Student? Can it call the setAge method?
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
