switch java 11

Solutions on MaxInterview for switch java 11 by the best coders in the world

showing results for - "switch java 11"
Nicolas
24 Aug 2018
1public String exampleOfSwitch(String animal) {
2    String result;
3    switch (animal) {
4        case "DOG":
5            result = "domestic animal"; 
6            break;
7        case "CAT":
8            result = "domestic animal";
9            break;
10        case "TIGER":
11            result = "wild animal";
12            break;
13        default:
14            result = "unknown animal";
15            break;
16    }
17    return result;
18}
19
Geoffrey
12 Sep 2019
1switch (profe) {
2  case "Anahí":
3    System.out.println("¡Profesora de Java!");
4    break;
5  case "Oscar":
6    System.out.println("¡Profesor de React.js!");
7    break;
8  case "JuanDC":
9    System.out.println("Oye niño, ¿qué haces aquí?");
10    break;
11  default:
12    System.out.println("¡Un nuevo profe!");
13    break;
14}
15