Results 1 to 3 of 3

Thread: enum to array

  1. #1
    eva
    eva is offline Member
    Join Date
    Dec 2007
    Posts
    49
    Rep Power
    0

    Default enum to array

    I have following enumeration and I want to convert it into an array.
    Java Code:
    public enum LANGUAGES{
    C, JAVA, VB
    }
    How to do that.

    - PEACE

  2. #2
    spoon! is offline Member
    Join Date
    Dec 2007
    Posts
    12
    Rep Power
    0

    Default

    why?
    . . .

  3. #3
    Ace_Of_John is offline Member
    Join Date
    Dec 2007
    Posts
    4
    Rep Power
    0

    Default

    i think its best to create an array of strings containing the names. then when a name is used in your function use another function to see what the sInput is and do the next operation based on that.im not sure why you want the enum`s in an array also there already in an array in a way you can find out where in the list ther are compared to the order uin which there defined

    Java Code:
    enum wee
    {
      one,
      two,
      three,
    }
    //////////////////
    
    main()
    {
      System.out.println(wee.three.ordinal());
    }
    the output will be 2
    Last edited by Ace_Of_John; 12-22-2007 at 07:56 PM. Reason: wrong word

Similar Threads

  1. Enum Error in JDK 1.6
    By nani5swamy in forum Advanced Java
    Replies: 1
    Last Post: 01-05-2008, 12:23 AM
  2. Constructor with enum
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-04-2008, 12:21 PM
  3. Enum Iteration
    By A.Russell in forum New To Java
    Replies: 1
    Last Post: 08-15-2007, 01:17 PM
  4. Enum?
    By vgbhagavan in forum Advanced Java
    Replies: 0
    Last Post: 06-14-2007, 03:02 PM

Posting Permissions

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