Java作业七(2017-10-30)

 1 /*造人*/
 2 public class Tman {
 3     public int id;
 4     public String name;
 5     public int age;
 6     public String city;
 7     public String introduce() {
 8       return  + id +  ":   name:  " + name + ", age:" + age + ", add:" + city ;
 9     }
10 }
 1 public class man {
 2 
 3     public static void main(String[] args) {
 4         // TODO Auto-generated method stub
 5         Tman p1=new Tman();
 6         Tman p2=new Tman();
 7         Tman p3=new Tman();
 8         Tman p4=new Tman();
 9                  p1.id=250;   p1.name="至尊宝";   p1.age=25;   p1.city="花果山";
10                  p2.id=250;   p2.name="紫霞";    p2.age=19;   p2.city="阿拉灯神丁";
11                  p3.id=250;   p3.name="青霞";    p3.age=19;   p3.city="阿拉灯神丁";
12                  p4.id=250;   p4.name="唐僧";    p4.age=43;   p4.city="盘丝洞";
13                  System.out.println(p1.introduce());
14                  System.out.println(p2.introduce());
15                  System.out.println(p3.introduce());
16                  System.out.println(p4.introduce());
17     }
18 
19 }

原文地址:https://www.cnblogs.com/chengxuyuanGM/p/7788959.html