public class Test { public static void main(String[] args) { // 创建不同图形对象 Shape circle = new Circle(3); Shape rect = new Rectangle(4, 5); Shape triangle = new Triangle(3, 4, 5); // 统一调用工具类打印面积 System.out.println("圆形:"); ShapeUtil.printArea(circle); System.out.println("矩形:"); ShapeUtil.printArea(rect); System.out.println("三角形:"); ShapeUtil.printArea(triangle); } }