title: java. redeclare class field within class initializer and local variable within method nested block(framed braces) differences
body: <p>I prepare for scjp exam and noticed surprising behaviour for me.</p>
  
  <pre><code>public class Test {
      int k;
      {
          int k; // it is valid variant
      }
      public static void main(String[] args) {
          int kk;
          {
              int kk; // NOT VALID.java: variable kk is already defined in method main(java.lang.String[])
          }
      }
      public void method (int var){
             int var;//NOT VALID.java: variable var is already defined in method method(int)
  
      }
  }
  </code></pre>
  
  <p>Always in my mind I kept following rule:
  I thought that all three variants is possible and inner definition would overlap external.</p>
  
  <p>example shows that it is wrong rule.</p>
  
  <p>Please clarify this situations and explain common rule for familiar situations.</p>
  
  <p><strong>P.S.</strong></p>
  
  <pre><code>public class Test {
     int k;
      {
          int k;
          {
              int k;  //java: variable k is already defined in instance initializer of class Test
          }
      }
  }
  </code></pre>