This is an example of single inheritance in java. In this example, βPersonβ is the base class, where βStudentβ is a derived class. If nothing is specified,
Person p = new Student ();
the p object (it is similar to the Person object) will get access to the properties of the Student class, which overrides the properties of its own base class Person.
Anchal shrestha
source share