public class ShapeUtil { public static void printArea(Shape shape) { System.out.println("图形面积为:" + shape.getArea()); } public static void main(String[] args) { Shape circle = new Circle(5); Shape rectangle = new Rectangle(4, 6); Shape triangle = new Triangle(3, 8); printArea(circle); printArea(rectangle); printArea(triangle); } }