In this java tutorial, we will understand the working of single inheritance in java with a program example. Single inheritance is the most simplest type of inheritance in java. We have a complete explanation of Inheritance in Java so if you don’t know what Inheritance in Java is then check this article out.
In single Inheritance, we have a single Super Class and a single Sub Class which inherits the properties from the Super class.
public void methodA()
System.out.println("Base class method");
Class B extends A
public void methodB()
System.out.println("Child class method");
public static void main(String args)
B obj = new B();
obj.methodA(); //calling super class method
obj.methodB(); //calling local method