?? usersex.java
字號:
/**
* @(#)data.UserSex.java 2008-8-30
* Copy Right Information : Tarena
* Project : JavaQQ
* JDK version used : jdk1.6.4
* Comments : 性別類。
* Version : 1.0
* Sr Date Modified By Why & What is modified
* 1. 2008-8-30 小豬 新建
**/
package data;
/**
* 性別類。
* 2008-8-30
* @author 達內科技[Tarena Training Group]
* @version 1.0
* @since JDK1.6(建議)
*/
public class UserSex {
private int type;
private String name;
public UserSex(int type,String name) {
this.type = type;
this.name = name;
}
public static UserSex Boy = new UserSex(0,"男");
public static UserSex Girl = new UserSex(1,"女");
public String toString() {
return name;
}
public String getName() {
return name;
}
public int getType() {
return type;
}
/**
* 根據性別類型,得到性別。
* @param type 類型。
* @return 性別。
*/
public static String getSex(int type){
return type==Boy.type?Boy.name:Girl.name;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -