blob: bebccf9b0845f96302ceb1823a44a30ccb294c10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package com.example;
public class SwitchStatements {
public static int simpleReturn(String value) {
switch (value) {
case "one":
return 1;
default:
return 0;
}
}
public static int simpleFallthroughReturn(String value) {
switch (value) {
case "one":
case "two":
return 1;
default:
return 0;
}
}
public static int noDefaultReturn(String value) {
switch (value) {
case "one":
return 1;
}
return 0;
}
}
|