1.代码
package Demo1;
class UE{
private String name; //用户名
private String password;//用户密码
private String sex; //用户性别
private int age; //用户年龄
private String date; //用户注册日期
private String grade; //用户等级
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
public UE() {
super();
}
public UE(String name, String password, String sex, int age, String date,
String grade) {
super();
this.name = name;
this.password = password;
this.sex = sex;
this.age = age;
this.date = date;
this.grade = grade;
}
public void show(){
System.out.println("大家好!我是"+name+",今年"+age);
System.out.println("我是"+date+"注册的,目前的等级是"+grade);
}
}
public class User {
public static void main(String[] args) {
UE u1=new UE("Lucy", "123456", "女", 21, "2011-01-08", "无敌小菜鸟");
u1.show();
System.out.println();
UE u2=new UE("Marry", "111111", "男", 28,"2000-01-01", "超级智多星");
u2.show();
}
}
2.截图