“this” reference escaping during construction?

前端 未结 4 2045
无人共我
无人共我 2020-12-07 04:07

If I do the following,

final class FooButton extends JButton{
    FooButton(){
        super(\"Foo\");
        addActionListener(new ActionListener(){
               


        
4条回答
  •  太阳男子
    2020-12-07 04:40

    Yes. this of the enclosing class is implicitly in an non-static anonymous class.

提交回复
热议问题