📄 athlete.java
字号:
package games;
class Athlete implements Comparable{
private String name;
private int number;
private String country;
private int time;
public Athlete(String name, int number, String country){
this.name = name;
this.number = number;
this.country = country;
}
public int getNumber(){
return this.number;
}
public String getName(){
return this.name;
}
public void setTime(int time){
this.time = time;
}
public int getTime(){
return this.time;
}
public int compareTo(Object obj) {
if( !(obj instanceof Athlete) )
throw new IllegalArgumentException();
return this.time - ((Athlete)obj).time;
}
public String toString(){
return name + " (" + country + ")";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -