Single Level inheritance - A class inherits properties from a single class. For example, Class B inherits Class A.
Example
class Shape { public void display() { System.out.println("Inside display"); } } class Rectangle extends Shape { public void area() { System.out.println("Inside area"); } } public class Tester { public static void main(String[] arguments) { Rectangle rect = new Rectangle(); rect.display(); rect.area(); } }
Output
Inside display Inside area
Here Rectangle class inherits Shape class and can execute two methods, display() and area() as shown.