1 public class Person { 
 2 String name; 
 3 int age; 
 4 public Person(String name,int age){ 
 5 this.name=name; 
 6 this.age=age; 
 7 }
 8 
 9 }
10 --------------------------------------------------------------
11 public class display {
12 
13     public static void main(String[] args) {
14         // TODO Auto-generated method stub
15         Person Xiaohong=new Person("小红",18); 
16         System.out.println(Xiaohong.name+"\n"+Xiaohong.age);
17 
18     }
19 
20 }

 

posted on 2018-07-26 10:28  九九九九  阅读(18867)  评论(0编辑  收藏  举报