封闭图像抽象类及其子类
Area.java:
public interface Area{
public double area();
}
Circle.java:
public final class Circle extends Ellipse //圆类,最终类
{
public Circle(double radius) //构造方法,radius参数指定圆的半径
{
super(radius,radius);
this.shape = "圆";
}
public Circle()
{
this(0);
}
public String toString()
{
return "半径"+this.radius_a;
}
public static void main(String[] args)
{
new Circle(10).print();
}
}
ClosedFigure.java:
public abstract class ClosedFigure //闭合图形抽象类
{
protected String shape; //形状