Results 1 to 6 of 6

Thread: Enumeration?

  1. #1

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205

    Enumeration?

    What is the Java syntax for an enumeration?

    Here's the VB equiv. of what I want:
    VB Code:
    1. Private Enum DoorMessage
    2.    CLOSE_FAST = 1
    3.    CLOSE_SLOW = 2
    4.    OPEN_FAST = 3
    5.    OPEN_SLOW = 4
    6. End Enum

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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;
    }
    Mark
    -------------------

  3. #3

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    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...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  4. #4
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    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
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

  5. #5

    Thread Starter
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    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?
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  6. #6
    Addicted Member Mrs Kensington's Avatar
    Join Date
    Sep 2001
    Location
    Dorset, UK
    Posts
    144
    If it works for you, great!
    Ford? Theres an infinite number of monkeys outside that want to talk to you about a script of hamlet they've produced!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width