this 有两种用法,如下:

Code
class Point
{
int x,y;
final int f;
Point(int x,int y)
{
this.x = x; //this表示后面的变量是类Point的属性
this.y = y; //this表示后面的变量是类Point的属性
f = 60;
}
Point()
{
this(10, 20); //this表示调用本类的构造函数Point(int x,int y)
System.out.println("LOADing");
}
public static void main(String [] args)
{
Point pt = new Point();
System.out.println(pt.f);
}
posted @
2008-09-18 09:04
小不点儿大的由我做主!
阅读(
125)
评论()
收藏
举报