According to the documentation, static variables are allowed only in outer classes. Why is that? Is it because you'd need to instantiate the inner class first?
InnerClass cannot have static members because it belongs to an instance (of OuterClass) and a static members means that this variable belongs to the entire class and not any particular instance.
MyClass outer = new MyClass(); MyInnerClass inner = outer.new MyInnerClass();
In apex, they are always treated as static on the outer class.MyClass.MyInnerClass inner = new MyClass.MyInnerClass();
Thus, it seems that statics would be perfectly fine in an inner class. I have no good answer why SF wouldn't allow them – NSjonas Sep 4 '15 at 18:57