...
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 |
---|
\[[Bloch 2001|AA. Bibliography#Bloch 01]\] Item 29, Minimize the scope of local variables \[[JLS 2005|AA. Bibliography#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], "Scope of Local Variable Declarations" |
...
05. Scope (SCP) 05. Scope (SCP) SCP01-J. Do not increase the accessibility of overridden or hidden methods