?? student.java
字號(hào):
/*
* 創(chuàng)建日期 2005-9-21
*
* TODO 要更改此生成的文件的模板,請(qǐng)轉(zhuǎn)至
* 窗口 - 首選項(xiàng) - Java - 代碼樣式 - 代碼模板
*/
package cn.itcareers.lxh.exercise.person;
import cn.itcareers.lxh.exercise.interfaces.StudentFlag;
/**
* @author 李興華
*
* 學(xué)生類(lèi)
*/
public class Student extends AbstractPerson {
/*
* (非 Javadoc)
*
* @see cn.itcareers.lxh.exercise.interfaces.Person#say()
*/
private float score;
/**
*
* @param name 姓名
* @param age 年齡
* @param score 成績(jī)
* @throws Exception
*/
public Student(String name, int age, float score) throws Exception {
super(StudentFlag.flag, name, age);
this.setScore(score);
}
/**
* @return 返回 score。
*/
public float getScore() {
return score;
}
/**
* @param score
* 要設(shè)置的 score。
*/
public void setScore(float score) {
this.score = score;
}
/**
* 比較排序方法
*/
public int compareTo(Object o) {
Student s = (Student) o;
if (this.score < s.score) {
return 1;
} else if (this.score > s.score) {
return -1;
} else {
if (this.getAge() < s.getAge()) {
return 1;
} else if (this.getAge() > s.getAge()) {
return -1;
} else {
return 0;
}
}
}
/**
* 打印信息時(shí)調(diào)用
*/
public String say() {
return "\t" + this.getId() + "\t\t" + this.getName() + "\t\t"
+ this.getAge() + "\t\t" + this.score;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -