Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Enums

 
Gabriel Fairbanks
Greenhorn
Posts: 4
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic