Its said that enums can be nested as top-level type declaration. Does it mean that it can be declared as a data member of a class, but it cannot be declared as a data member of a nested class as the nested class id not top-level ?

Recommended Answers

All 2 Replies

it is impossible to define a local (§14.3) enum, or to define an enum in an inner class (§8.1.3).

Java Language Reference version 1.6 section 8.9

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.