2
3 public class L {
4
5 public int id;
6 public String name;
7 public int age;
8 public String city;
9 public String introduce() {
10 return + id + ": 在下 " + name + ", 芳龄" + age + ", 家住" + city ;
11 }
12
13
14 }
1 package cn.zrjh;
2
3 public class Y {
4
5 public static void main(String[] args) {
6 L p1=new L();
7 L p2=new L();
8 L p3=new L();
9 L p4=new L();
10 p1.id=100000; p1.name="罗元昊"; p1.age=19; p1.city="418";
11 p2.id=200000; p2.name="孔宏旭"; p2.age=18; p2.city="418";
12 p3.id=300000; p3.name="于星晔"; p3.age=19; p3.city="418";
13 p4.id=400000; p4.name="黄浩然"; p4.age=19; p4.city="418";
14 System.out.println(p1.introduce());
15 System.out.println(p2.introduce());
16 System.out.println(p3.introduce());
17 System.out.println(p4.introduce());
18
19 }
20
21 }