abstract class Graphic{
String name; public Graphic(String name){ this.name=name; } abstract public void getlength(); abstract public void getArea();}class Circle extends Graphic{ public static final double PI=3.14159; double r; public Circle(String name,double r){ super(name); this.r=r; } public void getlength(){ System.out.println("圆的面积为 "+PI*r*r); } public void getArea(){ System.out.println("圆的周长为"+2*PI*r); }}class Recet extends Graphic{ int length; int width; public Recet(String name,int length,int width){ super(name); this.length=length; this.width=width; } public void getlength(){ System.out.println("矩行的面积为 "+length*width); } public void getArea(){ System.out.println("矩形的周长为"+2*(length+width)); }}public class demo1 { public static void main(String[]args){ Circle c=new Circle("圆",5.00); c.getlength(); c.getArea(); }}