abstract class Shape { public int x = 100, y = 100; public abstract int getArea(); } class Rectangle extends Shape { @Override public int getArea() { return x * y; } }
参考文献: Java Quick Syntax Reference by Mikael Olsson
Java 语法 索引 ----- 抽象类(Abstract)
时间: 2024-10-13 10:29:20