public class ShapeUtil { public static void printArea(Shape shape) { if (shape == null) { System.out.println("错误:图形对象为空"); return; } System.out.println("图形类型:" + shape.getShapeName()); System.out.println("面积:" + shape.getArea()); System.out.println("------------------------"); } }