Suppose the class Undergraduate extends the class Student wh…
Suppose the class Undergraduate extends the class Student which extends the class Person. Given the following variable declaration:Person p = new Person();Student s = new Student();Undergraduate ug = new Undergraduate(); Which of the following assignments are correct? 1) p = ug;2) p = new Undergraduate();3) ug = new Student();4) ug = p;