title: Java inner and nested classes
body: <p>I've started preparing myself for the OCJP7 exam and I found this chapter that seems to be very complicated.</p>
  
  <p>Let's say I have this code:</p>
  
  <pre><code>class Outer1{
      interface InnerInterface{
          String x = "test";
      }
      class InnerClass{
          String x = "test";
      }
  }
  class Outer2{
      static interface NestedInterface{
          String x = "test";
      }
      static class NestedClass{
          String x = "test";
      }
  }
  class Main{
      public static void main(String [] args){
          String s1 = Outer1.InnerInterface.x;
          String s2 = new Outer1().new InnerClass().x;
          String s3 = Outer2.NestedInterface.x;
          String s4 = new Outer2.NestedClass().x;
      }
  }
  </code></pre>
  
  <p>Could you tell me why we can access <code>Outer1.InnerInterface.x</code> and <code>Outer2.NestedInterface.x</code> in the same manner? Inner interfaces are static by default? I'm trying to make some connections to make them more clearly. </p>