This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes switch statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "switch statement" Watch "switch statement" New topic
Author

switch statement

Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
Every switch statement I've seen looks similar to

But I would like to replace the 1,2,3 with identifiers like
public static final Something = 1;
public static final SomethingElse = 2;
So that the case statements look like:
case Something: break;
case SomethingElse: break;
Can I do this? How? I can't get it to compile.
Thanks,
Frank
Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
Oops I had a bug in my code, I've got it working now!
Frank
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: switch statement
 
Similar Threads
Box or Unbox
Problems understanding the "default case" in a switch statement
Accessor methods on enum
final variable in switch
:( one more stupid misstake, pls help me !