aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "switch statement" Watch "switch statement" New topic

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.
Frank Hale
Ranch Hand

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