...
Code Block | ||
---|---|---|
| ||
public class Scope { public static void main(String[] args) { for (int i = 0; i < 10; i++) { // containsContains declaration // Do operations } } } |
...
Detecting multiple for
statements that use the same index variable is straightforward; it will produce false positives in the unusual case where this was intended by the programmer.
Bibliography
Item 29, Minimize the scope Scope of local variablesLocal Variables | |
[JLS 2011] |
...