Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    9
    Views
    1,481

    Re: Convert Enum to String in JAVA

    Your example looks like how to convert a String to an enum. Not how to convert an enum to a String.
  2. Replies
    9
    Views
    1,481

    Re: Convert Enum to String in JAVA

    If you must use an enum, then change day to be a Week object:

    Week day = ??? // no idea how to covert a String to a Week object
    Then switch(day) will work if you Remove the Week. from the case...
  3. Replies
    9
    Views
    1,481

    Re: Convert Enum to String in JAVA

    The case statements expect a String constant. Change the values used in the case statements to be Strings.
    For example create a class named Week. Add final static String variables using the names...
  4. Replies
    9
    Views
    1,481

    Re: Convert Enum to String in JAVA

    There is some missing details in your post:
    What source line did the error happen on?
    What is "We" in the message: We cannot be converted to String

    The case statements expect a String constant. ...
  5. Replies
    9
    Views
    1,481

    Re: Convert Enum to String in JAVA

    Please copy the full text of the error message and paste it here. The message should show the source line where the error happens.

    Note: An enum is not a String. The case statement wants String...
Results 1 to 5 of 5