abstract class RoundShape { protected class Center { int x,y; } protected Center C = new Center(); protected float radiusOfCircle; public RoundShape(int xCenter, int yCenter, float radius) { C.x=xCenter; C.y=yCenter; radiusOfCircle = radius; } abstract public float area(); } class Circle extends RoundShape { public Circle(int xCenter, int yCenter, float radius) { super(xCenter, yCenter, radius); } public float area() { return (float)(Math.PI*Math.pow((double)radiusOfCircle,2.0)); } } class Sphere extends RoundShape { public Sphere(int xCenter, int yCenter, float radius) { super(xCenter, yCenter, radius); } public float area() { return (float)(4.0*Math.PI*Math.pow((double)radiusOfCircle,2.0)); } } class AbstractExample1 { public static void main(String[] args) { Circle c = new Circle(5,5,2.5f); Sphere s = new Sphere(5,5,2.5f); System.out.println("Area of the circle is " + c.area()); System.out.println("Area of the sphere is " + s.area()); } }