GeeCON Prague 2014*
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


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
 
GeeCON Prague 2014
 
subject: switch statement