示例#1
0
 public static void main(String[] args) {
   // TODO Auto-generated method stub
   Shape s = getShape();
   System.out.println(s.toString());
   s.readShapeData();
   System.out.println(s.computeArea());
   System.out.println(s.computePerimeter());
 }
示例#2
0
 public static void main(String[] args) {
   Shape[] shapes = new Shape[2];
   Circle circle = new Circle();
   Ambiguous ambiguous = new Ambiguous();
   shapes[0] = circle;
   shapes[1] = ambiguous;
   for (Shape s : shapes) {
     s.printMe();
     System.out.println(s.computeArea());
   }
 }