java練習---10

來源:互聯網
上載者:User

標籤:log   com   練習   blog   void   oid   ret   9.png   ati   


 

 1 package cn.zrjh; 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 }

 

java練習---10

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.