wood burning stoves 2.0*
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: http://jibbering.com/faq/
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Enum in private inner class.
Similar Threads
Timer task
Enum inside an Enum
Inner Classes
doubt in enum code
Strange Enum behaviour?