public class ShapeUtil { public static void printArea(Shape shape) { if (shape == null) { System.out.println("图形对象不能为空!"); return; } System.out.printf("图形面积为:%.2f%n", shape.getArea()); } }