athlete.java
来自「A system to manage the competitions of t」· Java 代码 · 共 45 行
JAVA
45 行
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 + =
减小字号Ctrl + -
显示快捷键?