java编写一个地址薄的程序,设计一个能存储姓名、Email地址,并能显示姓名和Email地址的Address类。

2024-11-20 23:24:38
推荐回答(1个)
回答1:

public class Address {

private String name;
private String email;

public void display(){
System.out.println("姓名:"+this.getName()+" email:"+this.getEmail());
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}

}