• Java 7 – Strings en Switch Case

    Otro feature que se viene en Java 7 es la inclusion de Strings en los switch/case statements. Es sumamente bueno ya que vamos a poder utilizar el mismo statement y no usar un if/else si incluimos el uso de strings.

    String s = "test";
    switch(s) {
      case "foo":
        doSomething();
        break;
    }
    

    Tags:

Leave a comment