this只的就是当前编译的类this(0,0,width,height);给Rect的域变量(x1,y1,x2,y2)赋值

解决方案 »

  1.   

    public class Rect
    {
    public int x1,y1,x2,y2;
    public Rect(int width,int height)
    {
    this(0,0,width,height);
    }
    public Rect(int a,int b,int c,int d)
    {
    x1 = a;
    y1 = b;
    x2 = c;
    y2 = d;
    }
    public static void main(String[] args)
    {
    Rect a = new Rect(1,2);
    System.out.println(a.x1);
    System.out.println(a.y1);
    System.out.println(a.x1);
    System.out.println(a.y1);
    }
    }你看看上面这段代码,我想你应该清楚了