This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Enums

 
Gabriel Fairbanks
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi cowboys,



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


Example:



Prints out
CORAL
DAISY
ALGA



Yours,
Bu.
 
Gabriel Fairbanks
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. The book don't mention that! I'll create some code to better understand that topic.

Thanks again!

Gabriel
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic