The not-so-enhanced for loop
Posted July 6th, 2010 by CarlosIn Java, there’s a loop construct called “enhanced for loop” (it’s just a foreach, don’t get too excited). I decided to use it in the obvious, straightforward way thus: for(String str : words){ str = doSomething(str); } return words; Many will see the problem already. In Java, a variable doesn’t hold your data, everything (except [...]
Tags: for, for-loop, java, programming
Filed under:Programming