What does the colon (:) operator do?
问题 Apparently a colon is used in multiple ways in Java. Would anyone mind explaining what it does? For instance here: String cardString = \"\"; for (PlayingCard c : this.list) // <-- { cardString += c + \"\\n\"; } How would you write this for-each loop a different way so as to not incorporate the : ? 回答1: There are several places colon is used in Java code: 1) Jump-out label (Tutorial): label: for (int i = 0; i < x; i++) { for (int j = 0; j < i; j++) { if (something(i, j)) break label; // jumps