📄 person.java
字号:
//父类person
public abstract class Person {
private String name;//姓名
private String address;//地址
private String sex;//性别
private String phoneNo;//电话号码
private int age;//年龄
public Person(String n, String ad,String se,String p,int ag) {
this.setName(n);
this.setAddress(ad);
this.setSex(se);
this.setPhoneNo(p);
this.setAge(ag);
}
public Person() {
this.setName("?");
this.setAddress("???????");
this.setSex("???????");
this.setPhoneNo("???????????");
}
public void setName(String n) {
name = n;
}
public String getName() {
return name;
}
public void setAddress(String ad) {
address = ad;
}
public String getAddress() {
return address;
}
public void setSex(String se){
sex=se;
}
public String getSex(){
return sex;
}
public void setPhoneNo(String p) {
phoneNo = p;
}
public String getPhoneNo() {
return phoneNo;
}
public void setAge(int ag) {
age=ag;
}
public int getAge(){
return age;
}
public abstract String toString();
public void display() {
System.out.println("Person Information:");
System.out.println("\tName: " + this.getName());
System.out.println("\tSex:"+this.getSex());
System.out.println("\tAge:"+this.getAge());
System.out.println("\tAddress: " + this.getAddress());
System.out.println("\tphone number: " + this.getPhoneNo());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -