Skip to content

Commit 89dc92d

Browse files
committed
docs(lang-enh): 📓 string in switch
Refers: #4
1 parent 5a6ef35 commit 89dc92d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/org/j6toj8/languageenhancements/stringinswitch/StringInSwitch_ConstantOnly.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void getMonthName(final String may) {
1414
String apr = "apr";
1515

1616
switch (month) {
17-
case jan: // WON'T COMPILE - jan is a common attribute, can change at runtime
17+
case jan: // NOT COMPILING - jan is a common attribute, can change at runtime
1818
System.out.println("January");
1919
break;
2020
case FEB: // COMPILES - FEB is a compilation time constant, its value never changes
@@ -23,10 +23,10 @@ public static void getMonthName(final String may) {
2323
case mar: // COMPILES - mar is a constant at compilation time, its value never changes
2424
System.out.println("March");
2525
break;
26-
case apr: // WON'T COMPILE - apr is a common variable, can change at runtime
26+
case apr: // NOT COMPILING - apr is a common variable, can change at runtime
2727
System.out.println("April");
2828
break;
29-
case may: // WON'T COMPILE - may is final but not constant, may change at runtime
29+
case may: // NOT COMPILING - may is final but not constant, may change at runtime
3030
System.out.println("May");
3131
break;
3232
}

src/org/j6toj8/languageenhancements/stringinswitch/StringInSwitch_Default.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static void main(String[] args) {
1313
break;
1414
default: // COMPILES - `Default` can be in any position
1515
break;
16-
case "jan": // WON'T COMPILE - There is already case "jan"
16+
case "jan": // NOT COMPILING - There is already case "jan"
1717
System.out.println("January2");
1818
break;
1919
case "mar":

src/org/j6toj8/languageenhancements/stringinswitch/StringInSwitch_Type.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public static void main(String[] args) {
77

88
Long month = 1L;
99

10-
switch (month) { // WON'T COMPILE - Long is not a supported type.
10+
switch (month) { // NOT COMPILING - Long is not a supported type.
1111
case 1L:
1212
System.out.println("January");
1313
break;

0 commit comments

Comments
 (0)