This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enum Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enum Constructor" Watch "Enum Constructor" New topic

Enum Constructor

Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361

The result is shown as a 'compilation fail' because a enum constructor that takes a string must be supplied. How can I get this to compile?
Stary Kapec
Ranch Hand

Joined: Dec 04, 2005
Posts: 81
Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
Thanks a bunch!
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If you want to see "bright" and "dark" when you print Turn.ON and Turn.OFF respectively, then you can add (to Jasiek's code):

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
subject: Enum Constructor
Similar Threads
Enum Constructor - Exception and Accessibility
Start java enum ordinal at 1 instead of 0
Doubt on Enums
Why can an enum constructor be "package-private"?
call constructor from super-enum