KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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: for (String crt : {"a","b","c"} ) { doSomething(); } actually doesn't work while String[] arr = {"a","b","c"}; for (String crt : arr ) { doSomething(); } does. Even casting the array to String[] doesn't help. When moving the cursor over the first version, eclipse tells me: Type mismatch: cannot convert from String[] to String while meaning "crt". Is this a bug?
Tags (comma-separated)
Save Edits
Cancel