aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Static Enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Static Enums" Watch "Static Enums" New topic
Author

Static Enums

Gabriel Fairbanks
Greenhorn

Joined: Jul 30, 2004
Posts: 4
Hi,

I'm reading the K&B Java 5 Study Guide and I have a doubt. If I declare an ENUM inside a class, I can use the static modifier, but if I declare an ENUM outside, I still could use that ENUM inside a static method? (I know that I can't mark an outside ENUM as static).

Thank's

Gabriel Fairbanks
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi cowboys,



yes you can use enums outside a class like a normal class


Example:



Prints out
CORAL
DAISY
ALGA



Yours,
Bu.


all events occur in real time
Gabriel Fairbanks
Greenhorn

Joined: Jul 30, 2004
Posts: 4
Thank you for the reply. The book don't mention that! I'll create some code to better understand that topic.

Thanks again!

Gabriel
 
Consider Paul's rocket mass heater.
 
subject: Static Enums