Re: Using an enum in a constructor
Roedy Green wrote:
On Sun, 23 Sep 2007 18:21:32 GMT, Wojtek <nowhere@a.com> wrote, quoted
or indirectly quoted someone who said :
Ah, ok, I see now. This enum beast is kind of a funny sort of class....
Enums made no sense until I started decompiling code and seeing how
they work under the hood. I have posted the results of my experiments
at http://mindprod.com/jgloss/enum.html
I love that article. It clarifies enum semantics for me.
I do have one small nit over it, with respect to specifics of nested class
terminology:
I have managed to get nested static inner enums and nested instance inner enums to work as well,
There isn't actually a difference for enums:
Nested enum types are implicitly static.
It is permissable to explicitly declare a nested enum type to be static.
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9>
Also, an "inner class" according to the JLS is the opposite of static nested,
which both are subcategories of nested classes:
An /inner class/ is a nested class that is not explicitly or implicitly declared static.
(emphasis original)
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.3>
The terms as defined by the JLS are much more specific than they are in
general usage.
--
Lew