File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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!
wood burning stoves
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 !