class Point
{
int x,y;
Point(int a,int b)
{
x=a;
y=b;
}
Point()
{
this(1,1); //这个调用怎么会调用上面的POINT呢
}
void output()
{
System.out.println(x);
System.out.println(y);
}
void output(int x,int y)
{
this.x=x,
this.y=y;
}
public static void main(String[] args)
{
Point pt;
pt=new Point();
pt.output();
}
}
{
int x,y;
Point(int a,int b)
{
x=a;
y=b;
}
Point()
{
this(1,1); //这个调用怎么会调用上面的POINT呢
}
void output()
{
System.out.println(x);
System.out.println(y);
}
void output(int x,int y)
{
this.x=x,
this.y=y;
}
public static void main(String[] args)
{
Point pt;
pt=new Point();
pt.output();
}
}
因为它调用了Point();这个构造函数。