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

prosseek picture prosseek · Apr 22, 2013 · Viewed 16.2k times · Source

I have an inner class in my Java class.

enter image description here

When I run find bugs, it recommends(warns) to make it as static.

enter image description here

What's the point of this warning? What's the advantage of making a inner class as static?

Answer

Jeff Storey picture Jeff Storey · Apr 22, 2013

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.