File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Enum in private inner class. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Enum in private inner class." Watch "Enum in private inner class." New topic

Enum in private inner class.

Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
Why do I get a compiler error by putting enum SortKey inside the inner class?

Error:The member enum SortKey must be defined inside a static member type

comp.lang.javascript FAQ:
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
enums are implicitly static
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
...and inner classes cannot have static members. Logical consequence is that inner classes cannot declare enums.
I agree. Here's the link:
subject: Enum in private inner class.
jQuery in Action, 3rd edition