|
-
May 4th, 2007, 02:42 PM
#3
Re: Enumerations in Java Help
And if yes, you might want to make the enum and the variable that is of enum type static. Or create an instance of the class and put the switch in a non-static method.
Also, in switches on enums, you don't need to (and AFAICR can't) prefix the constants, i.e. it's just
Code:
switch(appState)
{
case MAIN_MENU:
And another thing I've hinted at: because of the enum constants' name lookup rules, giving them a common prefix ought to be unnecessary.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|