Module 6 Encapsulation and Inheritance
Module 6 Encapsulation and Inheritance
6.1
Vehicle
Truck Car
Types of Inheritance:
Types of Inheritance:
Take Note:
Inside Person:Constructor
Inside Student:Constructor
Inside Person:Constructor
Inside Student:Constructor
public Student(){
super( "SomeName", "SomeAddress" );
System.out.println("Inside Student:Constructor");
}
public Student(){
super();
System.out.println("Inside Student:Constructor");
}
For example,
public Student()
{
super.name = “somename”;
super.address = “some address”;
}
Student: getName
Static methods are automatically final. This means that you cannot
override them.