java构造函数

 1 public class Person
 2 {
 3     int id;
 4     int age;
 5     Person(int _id,int _age)
 6     {
 7         id=_id;
 8         age=_age;
 9     }
10     public static void main(String[] ages)
11     {
12         Person tom=new Person(1,25);
13         Point p=new Point();                    
14     }
15 }    
16 class Point
17 {
18     Point()
19     {
20     
21     }
22     
23     int x;
24     int y;
25 }

 

posted @ 2013-03-27 09:11  glt66  阅读(115)  评论(0编辑  收藏  举报