Static Members in Inner Classes? The Answer
Join the DZone community and get the full member experience.Join For Free
I asked a question a few days ago, regarding static members in inner classes. I presented an example with two static members, one was integer the other Object type, the integer compiled correctly and the Object did not. Here's how it looks like in the IDE:
Inner classes may not declare static members, unless they are compile-time constant fields
By the way, if the class was a static nested class, rather than an inner-class, there wouldn't be any problem defining static members. Plus, constants are inherited when using extensions. This means that the following is legit:
Opinions expressed by DZone contributors are their own.