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+" "+Xiaohong.age); 17 18 } 19 20 }