Search:

Type: Posts; User: Norm

Search: Search took 0.13 seconds.

  1. Replies
    9
    Views
    2,807

    Re: Yes or No answers,

    Sorry, I know nothing about your IDE.
    This code works for me with 1.7:


    String key = "ABC";
    switch (key) {
    case "ABC":
    System.out.println("works"); //...
  2. Replies
    9
    Views
    2,807

    Re: Yes or No answers,

    If you use Java 1.7 to compile(javac) it and execute(java) it, it should work.
  3. Replies
    9
    Views
    2,807

    Re: Yes or No answers,

    The IDEs message looks like it doesn't know about the new switch in java 1.7
    @Sean4u - your syntax looks right.
  4. Replies
    9
    Views
    2,807

    Re: Yes or No answers,

    What error message do you get from the 1.7 javac compiler?
  5. Replies
    9
    Views
    2,807

    Re: Yes or No answers,

    You'll have to get java 1.7 for that style of switch statement. Until then only integers work.

    A work around is a chain of if/else if/else if /else statements to compare the Strings.
    Be sure to...
Results 1 to 5 of 5