用eclipse编写一个类
答案:1 悬赏:0 手机版
解决时间 2021-12-03 06:33
- 提问者网友:眉目添风霜
- 2021-12-02 16:26
用eclipse编写一个类
最佳答案
- 五星知识达人网友:想偏头吻你
- 2021-12-02 17:16
public class Student {
private String name;
private String id;
private int age;
private String address;
private String telephone_number;
private String bedroom_number;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getBedroom_number() {
return bedroom_number;
}
public void setBedroom_number(String bedroom_number) {
this.bedroom_number = bedroom_number;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelephone_number() {
return telephone_number;
}
public void setTelephone_number(String telephone_number) {
this.telephone_number = telephone_number;
}
public String toString() {
return getName()+"\t"+getId()+"\t"+getAge()+"\t"+getAddress()+"\t"+getTelephone_number()+"\t"+getBedroom_number();
}
public static void main(String[] args) {
Student s=new Student();
System.out.println("name\tid\tage\taddress\ttelephone_number\tbedroom_number");
s.setName("张三");
s.setId("2222222");
s.setAge(22);
s.setAddress("百度知道问题");
s.setTelephone_number("110.119.120");
s.setBedroom_number("888");
System.out.println(s.toString());
}
}
private String name;
private String id;
private int age;
private String address;
private String telephone_number;
private String bedroom_number;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getBedroom_number() {
return bedroom_number;
}
public void setBedroom_number(String bedroom_number) {
this.bedroom_number = bedroom_number;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelephone_number() {
return telephone_number;
}
public void setTelephone_number(String telephone_number) {
this.telephone_number = telephone_number;
}
public String toString() {
return getName()+"\t"+getId()+"\t"+getAge()+"\t"+getAddress()+"\t"+getTelephone_number()+"\t"+getBedroom_number();
}
public static void main(String[] args) {
Student s=new Student();
System.out.println("name\tid\tage\taddress\ttelephone_number\tbedroom_number");
s.setName("张三");
s.setId("2222222");
s.setAge(22);
s.setAddress("百度知道问题");
s.setTelephone_number("110.119.120");
s.setBedroom_number("888");
System.out.println(s.toString());
}
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯