Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: fix code style in examples; canonicalize JLS ref in bibliography section

...

Code Block
bgColor#FFcccc
public class Scope {
  public static void main(String[] args) {
    int i = 0;
    for (i = 0; i < 10; i++) {
      // Do operations
    }
  }
}

...

Code Block
bgColor#ccccff
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