public class Foo { public static enum Bar { } } public class Foo { public enum Bar { } }
Friday, March 2, 2018
Nested Enums
Little known fact that I also only just found out about: nested enum types are implicitly static in Java (see the JLS). However, it is permitted for the declaration of a nested enum type to redundantly specify the static modifier. In other words, the following two enum declarations are effectively equivalent:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment