java编写程序,设计记录生日信息的birthdate类,该类需声明三个属性,分别是表示生日的年

日,并提供三个设置和读取属性的方法。要全过程!!!
2025-05-07 05:32:22
推荐回答(1个)
回答1:


/**   
 * @ClassName: Birthdate   
 * @Description: TODO(记录生日信息生日)   
 * @author someOne
 * @date 2015-1-13 上午9:27:25   
 *   
 */

public class Birthdate {
/**
 * 年月日的字段String类型
 * 可以换成int类型或者其他,根据需要
 */
private String year;
private String mouth;
private String day;

/**
 * 下面都是属性的set,get方法
 * @Title: getYear   
 * @Description: TODO(属性值的设置和读取方法)   
 * @param @return    设定文件   
 * @return String    返回类型   
 * @throws
 */
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getMouth() {
return mouth;
}
public void setMouth(String mouth) {
this.mouth = mouth;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this.day = day;
}

}