For the next three problems, consider the following class: Also consider the following partial implementation of a

Question:

For the next three problems, consider the following class:

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

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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: