This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Static Enums  RSS feed

 
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!