While I was trying something special in for loop I recognized that Java doesn\'t seem to like putting an anonymous array right as the source for a for-each-loop:
<
You want
for (String crt : new String [] {"a","b","c"} ) {
doSomething();
}
I use IntelliJ and it says put the message "expression expected" on the right-hand side of the colon in the for-loop, which seems more accurate.
I should add that IntelliJ also offers to add the "new String []" automagically for me.