7.Write a Java program to create an abstract class named Shape that contains two integers and an empty method named print Area (). Provide three classes named Rectangle, Triangle, and Circle such that each one of the classes extends the class Shape. Each one of the classes contains only the method print Area () that prints the area of the given shape.

import java.lang.*;

abstract class Shape

{

int a, b;

abstract void printArea();

}

class Rectangle extends Shape

{

public Rectangle(int x, int y)

{

a = x;

b = y;

}

public void printArea()

{

System.out.println("Rectangle Area is " + (a * b));

}

}

class Triangle extends Shape

{

public Triangle(int x, int y)

{

a = x;

b = y;

}

public void printArea()

{

System.out.println("Triangle Area is " + (0.5 * a * b));

}

}

class Circle extends Shape

{

public Circle(int x)

{

a = x;

}

public void printArea()

{

System.out.println("Circle Area is " + (3.14 * a * a));

}

}

public class AbsDemo

{

public static void main(String[] args)

{

Rectangle r = new Rectangle(10,20);

Triangle t= new Triangle(5,10);

Circle c = new Circle(8);

r.printArea();

t.printArea();

c.printArea();

}

}

OUTPUT: