package lianxi;
public class Q {
public int id;
public String name;
public int age;
public String city;
public String introduce() {
return "My id=" + id + ", name=" + name + ", age=" + age + ", city=" + city ;
}
}
package lianxi;
public class W {
public static void main(String[] args) {
// TODO Auto-generated method stub
Q p1=new Q();
Q p2=new Q();
Q p3=new Q();
Q p4=new Q();
p1.id=110001; p1.name="刘备";
p1.age=43; p1.city="蜀国";
p2.id=110002; p2.name="关羽";
p2.age=35; p2.city="蜀国";
p3.id=110003; p3.name="张飞";
p3.age=32; p3.city="蜀国";
p4.id=110004; p4.name="诸葛亮";
p4.age=25; p4.city="蜀国";
System.out.println(p1.introduce());
System.out.println(p2.introduce());
System.out.println(p3.introduce());
System.out.println(p4.introduce());
}
}