public class ShapeTest { public static void main(String[] args) { // 创建各个图形对象 Shape c = new Circle(5); Shape r = new Rectangle(4,6); Shape t = new Triangle(3,4); //统一调用工具打印面积 System.out.print("圆形:"); ShapeUtil.printArea(c); System.out.print("矩形:"); ShapeUtil.printArea(r); System.out.print("三角形:"); ShapeUtil.printArea(t); } }