Which of the following would be legal statements Consider th
Which of the following would be legal statements?
Consider the following classes: public class Teacher {...} public class Lecturer extends Teacher {...} public class Professor extends Teacher {...} Which of the following would be legal statements? Teacher t = new Lecturer(); Teacher t = new Professor(); Lecturer I = new Professor(); Professor p = new Professor(); Professor p = new Teacher(); Lecturer I = new Teacher();Solution
We can not instantiated the child object with parent object reference. But we can instantiated the parent object with child object reference.
