Question: For the next three problems, consider the following class: Also consider the following partial implementation of a subclass of Student to represent undergraduate students at
For the next three problems, consider the following class:

Also consider the following partial implementation of a subclass of Student to represent undergraduate students at a university:

Can the code in the UndergraduateStudent class access the name and age fields it inherits from Student ? Can it call the setAge method?
1 // Represents a university student. 2 public class Student { 3. private String name; private int age; 9. public Student (String name, int age) { 7 this.name name; 8. this.age = age; } 10 11 public void setAge (int age) { 12 this.age = age; 13 14
Step by Step Solution
3.45 Rating (174 Votes )
There are 3 Steps involved in it
The class Student has instance variables name and age ... View full answer
Get step-by-step solutions from verified subject matter experts
