Static implies that it can be used without any instance. To create instances of objects of a non-stationary inner class, an instance of the outer class is required. Without an object of an outer class, a non-stationary nested inner class cannot be created.
class Inner2 { static final Directions D3 = Directions.NORTH; }
Inner2 is not static. Inner2 cannot be used until it is created. Therefore, any references or methods can be used only after its creation. Since Inner2 is not static, the existence of D3 only makes sense after we have an Inner2 object and it is declared as static, it makes no sense.
In the second question, I have another doubt, so I prefer to add a link to the question I asked: Why is it allowed to compile time constants static in non-stationary inner classes?
I hope that when we have the answer to this question, we will have a better understanding.
source share