File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes A static enumeration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A static enumeration" Watch "A static enumeration" New topic
Author

A static enumeration

Mrinal Singhania
Greenhorn

Joined: Sep 30, 2012
Posts: 7
Hi,

The below code compiles fine even if the "static" keyword is removed for the enum declaration.



Can someone please explain?

Thanks.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4397
    
    8

From the Java Language Specification:
Nested enum types are implicitly static. It is permissible to explicitly declare a nested enum type to be static.

So it doesn't matter if you declare it as static or not, it will be treated as if it was.
 
GeeCON Prague 2014
 
subject: A static enumeration