All enum effective static . If you have a nested enum, this is almost the same as a static class .
All classes are lazily loaded (enumerations or otherwise), however, when they are loaded, they are loaded immediately. that is, you cannot load multiple constants, but not others (except for the middle of the class initialization).
Java allows some modifiers to be hidden so that there is no need to declare them all the time. This means that adding a modifier does not have to do anything other than providing a longer way to write the same thing.
The default modifiers for
class / method / nested class - package local, not finite, non-static
enum and nested enum - local, final, and static package
interface field - public static final
interface - public abstract
nested class in interface - public static , not final
Note: while static is optional for enum , it is always static. However, final cannot be set to an enumeration, even if it always has the value final (technically you can have subclasses with overridden implementations for constants)
EDIT: The only place you need to use static with enum is with import static enumeration values. Thanks @ man910
Peter Lawrey Apr 17 '14 at 8:19 2014-04-17 08:19
source share