class point{
int x;
int y;
point(int x,int y){
this.x=x;//如果形参和属性名相同,为了区分开来,必须要在属性名前加this
y=y;//若不加this,则其值还是默认定义的0
}
}
public class This {
public static void main(String[] args) {
point p = new point(1,2);
System.out.println("x的值为:"+p.x);
System.out.println("y的值为:"+p.y);
}
}