实操1:提取百战婚恋交友的用户类并对属性进行封装

  • @author 祁蒙恩
  • 实操1:提取百战婚恋交友的用户类并对属性进行封装
  • 实现思路:
  • 1.新建用户类User
  • 2.封装User的属性
  • 3.编写共有的getter和setter方法
  • 4.编写无惨构造、带昵称和密码的有参构造、带全部参数的构造

/**
 * @author 祁蒙恩
 * 实操1:提取百战婚恋交友的用户类并对属性进行封装
 * 实现思路:
 * 	1.新建用户类User
 * 	2.封装User的属性
 * 	3.编写共有的getter和setter方法
 * 	4.编写无惨构造、带昵称和密码的有参构造、带全部参数的构造
 */
public class User {
	//私有属性
	private String nickName;		//昵称
	private String gender;			//性别
	private String birthday;		//出生日期
	private String address;			//常住地址
	private String marryState;		//婚姻状况
	private double height;			//身高
	private double salary;			//月薪
	private String phone;			//手机号
	private String password;		//密码
	private String introduce;		//自我介绍
	private String degreeOfLearning;	//学历
	//公有的取值,赋值方法
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getMarryState() {
		return marryState;
	}
	public void setMarryState(String marryState) {
		this.marryState = marryState;
	}
	public double getHeight() {
		return height;
	}
	public void setHeight(double height) {
		this.height = height;
	}
	public double getSalary() {
		return salary;
	}
	public void setSalary(double salary) {
		this.salary = salary;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getIntroduce() {
		return introduce;
	}
	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}
	public String getDegreeOfLearning() {
		return degreeOfLearning;
	}
	public void setDegreeOfLearning(String degreeOfLearning) {
		this.degreeOfLearning = degreeOfLearning;
	}
	
	//构造方法
	public User(String nickName, String gender, String birthday, String address, String marryState, double height,
			double salary, String phone, String password, String introduce, String degreeOfLearning) {
		super();
		this.nickName = nickName;
		this.gender = gender;
		this.birthday = birthday;
		this.address = address;
		this.marryState = marryState;
		this.height = height;
		this.salary = salary;
		this.phone = phone;
		this.password = password;
		this.introduce = introduce;
		this.degreeOfLearning = degreeOfLearning;
	}
	
	public User(String nickName, String password) {
		super();
		this.nickName = nickName;
		this.password = password;
	}
	public User(){
		super();
	}
	
	
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值