只知道this在方法中是指隐式参数,还可以调用类中的其他构造函数,但是如果在一个类名后,应该怎么理解?
如:Manager.this

解决方案 »

  1.   

    this引用
    (1)指代对象本身。
    (2)访问本类的成员变量或成员方法。
    如:this.<变量名>
        this.<方法名>
    (3)调用本类的构造方法
      

  2.   

    Manager.this
    没有这个写法吧?
      

  3.   

    Manager是包吧.this指的是当前类的对象.
      

  4.   

    不是的``` 
    这是在一个类的构造器里的
    如Class b=new Class(Class c.this);
      

  5.   

    好像是内部类对外部类的引用,用的是外部类名.this。
      

  6.   

    上面的CLASS C 就是外部类
      

  7.   

    this 就是类的当前实例,它不能在static修饰的语句块里使用
      

  8.   

    不能省略的地方主要有三个:
    1、在自身的构造方法内部调用自身的其他构造方法
        public Test(){
            this(10);
        }    public Test(int n){    }
    2、代表自身类的对象
    3、使用this.属性名引用被覆盖掉的属性
      

  9.   

    this:调用这个函数的那个对象
      

  10.   

    对于 Manager.this 这样的语句,它肯定在Manager这个类的内部,也许直接在Manager下,也许在Manager的内部类InManager中,也许在它内部类的内部类InInManager中.....对于这最后一种情况,使用Manager.this、InManager.this、InInManager.this都是可以的,当然InInManager.this==this引用this的语句不能处于static上下文中
      

  11.   

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class test extends JFrame
    {
            public test()
            {
                    super( "Test" );
                    
                    JButton b = new JButton( "Click");
                    b.addActionListener( new ActionListener()
                    {
                            public void actionPerformed( ActionEvent e )
                            {
                                    JOptionPane.showMessageDialog( test.this, "Just a test", "test", JOptionPane.PLAIN_MESSAGE );
                            }
                    });
                    
                    getContentPane().add( b );
                    setSize( 300, 400 );
                    setVisible( true );
            }
            public static void main( String [] args )
            {                
                    test f = new test();
                    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            }

    ---------------------------------------------------------------------
    直接用this将传递一个匿名内置类(匿名内部类)ActionListener,用test.this则传递test的实例对象。
    参考!!!!
      

  12.   

    不能类名点this的
    this()表示调用自己类的构造函数
    this.xx表示调用本类的变量,变量名是xx