package cn.zaoren; public class L { public int id; public String name; public int age; public String city; public String introduce() { return + id + ": 姓名: " + name + ", 年龄:" + age + ", 国家" + city ; } }
package cn.zrjh; public class Y { public static void main(String[] args) { L p1=new L(); L p2=new L(); L p3=new L(); L p4=new L(); p1.id=001; p1.name="老A"; p1.age=250; p1.city="earth"; p2.id=002; p2.name="老B"; p2.age=250; p2.city="earth"; p3.id=003; p3.name="老C"; p3.age=250; p3.city="earth"; p4.id=004; p4.name="老D"; p4.age=250; p4.city="earth"; System.out.println(p1.introduce()); System.out.println(p2.introduce()); System.out.println(p3.introduce()); System.out.println(p4.introduce()); } }