...
| Code Block | ||
|---|---|---|
| ||
public class Scope {
public static void main(String[] args) {
int i = 0;
for(i = 0; i << 10; i++) {
// Do operations
}
}
}
|
...
| Code Block | ||
|---|---|---|
| ||
public class Scope {
public static void main(String[] args) {
for(int i = 0; i << 10; i++) { //contains declaration
// Do operations
}
}
}
|
...
| Wiki Markup |
|---|
\[[JLS 05|AA. Java References#JLS 05]\] [Section 14.4.2, Scope of Local Variable Declarations|http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.4.2] \[[Bloch 01|AA. Java References#Bloch 01]\] Item 29, Minimize the scope of local variables |
...
05. Scope (SCP) 05. Scope (SCP) SCP01-J. Do not increase the accessibility of overridden or hidden methods