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 }
原文地址:https://www.cnblogs.com/delphione/p/2983903.html