小弟对this的用法以及概念比较模糊,不大清楚.
望指点!

解决方案 »

  1.   

    楼主看看thinking in java吧,一下就是一部分内容了Suppose you’re inside a method and you’d like to get the reference to the current object. Since that reference is passed secretly by the compiler, there’s no identifier for it. However, for this purpose there’s a keyword: this. The this keyword—which can be used only inside a method—produces the reference to the object the method has been called for. You can treat this reference just like any other object reference. Keep in mind that if you’re calling a method of your class from within another method of your class, you don’t need to use this. You simply call the method. The current this reference is automatically used for the other method.
      

  2.   

    this就是指自己,具体的还需要好好体会。
      

  3.   

    this 是指当前对象class A
    {
    public A()
    {
    this.B();//指调用当前对象自己的方法B() 既使有人覆盖了B()方法,依然会调用当前类的B()方法,而不会去调用 重写后的B()方法
    }public A(int a)
    {
    this.a = a;//用以区分相同名称的变量 将参数a赋给当前对象自己的成员变量a
    }private void B()
    {
    }private int a;
    }
      

  4.   

    this是指当前对象自己。 
    当在一个类中要明确指出使用对象自己的的变量或函数时就应该加上this引用。如下面这个例子中: public class A { String s = "Hello"; public A(String s) { 
    System.out.println("s = " + s); 
    System.out.println("1 -> this.s = " + this.s); 
    this.s = s; 
    System.out.println("2 -> this.s = " + this.s); 
    } public static void main(String[] args) { 
    new A("HelloWorld!"); 

    } 运行结果: s = HelloWorld! 
    1 -> this.s = Hello 
    2 -> this.s = HelloWorld! 在这个例子中,构造函数A中,参数s与类A的变量s同名,这时如果直接对s进行操作则是对参数s进行操作。若要对类A的变量s进行操作就应该用this进行引用。运行结果的第一行就是直接对参数s进行打印结果;后面两行分别是对对象A的变量s进行操作前后的打印结果。 
      

  5.   

    结合super 来说吧
    this 指的是当前对象的引用
    super 指的是当前对象的直接父类的引用
    --
    每个对象实例,都有一个指向自己的引用