📄 comparablerectangle.java
字号:
public class ComparableRectangle extends Rectangle implements Comparable { /** Construct a ComparableRectangle with specified properties */ public ComparableRectangle(double width, double height) { super(width, height); } /** Implement the compareTo method defined in Comparable */ public int compareTo(Object o) { if (findArea() > ((ComparableRectangle)o).findArea()) return 1; else if (findArea() < ((ComparableRectangle)o).findArea()) return -1; else return 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -