Java Program multilevel inheritance using super keyword
In this program, You will learn how to implement multilevel inheritance using super keyword in java.
void msg() {
super.msg();
}
Example: How to implement multilevel inheritance using super keyword in java.
class A {
void msg() {
System.out.println("A is called here");
}
}
class B extends A {
void msg() {
super.msg();
System.out.println("B is called here");
}
}
class Main extends B {
void msg() {
super.msg();
System.out.println("C is called here");
}
public static void main(String args[]) {
Main cc = new Main();
cc.msg();
}
}
Output:
A is called here
B is called here
C is called here