What is the Java syntax for an enumeration?
Here's the VB equiv. of what I want:
VB Code:
Private Enum DoorMessage CLOSE_FAST = 1 CLOSE_SLOW = 2 OPEN_FAST = 3 OPEN_SLOW = 4 End Enum
:confused:
Printable View
What is the Java syntax for an enumeration?
Here's the VB equiv. of what I want:
VB Code:
Private Enum DoorMessage CLOSE_FAST = 1 CLOSE_SLOW = 2 OPEN_FAST = 3 OPEN_SLOW = 4 End Enum
:confused:
This sort of thing:
Code:class DoorMessage {
static int CLOSE_FAST = 1;
static int CLOSE_SLOW = 2;
static int OPEN_FAST = 3;
static int OPEN_SLOW = 4;
}
Cool thanks.
Also - what's a useful Java compiler? I've got JBuilder3, but it doesn't like the project I'm working on (it's a Uni thing - I've got to make some changes to an existing system). Keeps giving me errors, when I know this code compiled somehow...
JBuilder isn't a compiler its a GUI.
You'll be best learning how to compile at the command line as it makes it alot easier to set up gui's if you know how the compiler works.
You should have it installed already. Just search your computer for javac.exe. If you don't have it you need to download the SDK from http://java.sun.com/j2se/1.4/download.html
Once you've found it change your PATH variable (look on the internet if you don't know how as it varies by OS) to point to javac.exe
To compile you go to the directory your code is in and type Javac myClass.java (where myClass is the name of the class) or you can do javac *.java
Then just run it by typing java myClass (***NOTE*** no extension)
Hope that helps
Awesome. Cheers. :)
I've got the SDK and all that. I think my best approach will be to use JBuilder for development work, but not builds. It has a nice interface - colour coding and all that.
Yeah?
If it works for you, great!