What's the advantage of making an inner class as static with Java?

后端 未结 6 1279
梦毁少年i
梦毁少年i 2020-12-13 18:21

I have an inner class in my Java class.

\"enter

When I run find bugs, it recom

6条回答
  •  一生所求
    2020-12-13 19:14

    If the nested class does not access any of the variables of the enclosing class, it can be made static. The advantage of this is that you do not need an enclosing instance of the outer class to use the nested class.

提交回复
热议问题