Categories
Uncategorized

Single Inheritance

Simple example of single inheritance import java.util.Scanner; class rectangle { double length, breadth; void get() { Scanner a= new Scanner(System.in); System.out.println(“enter lenght and breadth:”); length=a.nextDouble(); breadth=a.nextDouble(); } void display() { double ar; ar=length*breadth; System.out.println(“Area of Rectangle:”+ar); } } class square extends rectangle