JAVA-this

来源:互联网 发布:删除存储过程 sql 编辑:程序博客网 时间:2024/05/16 09:34
public class Point {    public int x = 0;    public int y = 0;            //constructor    public Point(int a, int b) {        x = a;        y = b;    }}

public class Point {    public int x = 0;    public int y = 0;            //constructor    public Point(int x, int y) {        this.x = x;        this.y = y;    }}
************
public class Rectangle {    public int width = 0;    public int height = 0;    public Point origin;    // four constructors    public Rectangle() {        origin = new Point(0, 0);    }    public Rectangle(int w, int h) {        origin = new Point(0, 0);        width = w;        height = h;    }   ...}

public class Rectangle {    private int x, y;    private int width, height;            public Rectangle() {        this(0, 0, 0, 0);    }    public Rectangle(int width, int height) {        this(0, 0, width, height);    }    ...}


0 0
原创粉丝点击