title: Way to call inner class by outer class
body: <p>I know that to instantiate a member inner class, you have two different constructors:</p>
  
  <p>First:</p>
  
  <pre><code>Outer out = new Outer();
  Outer.Inner in = out.new Inner();
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>Outer.Inner in = new Outer().new Inner();
  </code></pre>
  
  <p>Now, I don't know why this code compiles:</p>
  
  <pre><code>public class Outer {
  
      private String greeting="Hi";
  
      protected class Inner {
          public int repeat=3;
  
          public void go() {
              for (int i =0; i&lt;repeat; i++) {
                  System.out.println(greeting);
              }
          }
      }
  
      public void callInner() {
          Inner in = new Inner(); //in my opinion the correct constructor is Outer.Inner in = new Inner()
          in.go();
      }
  
      public static void main(String[] args) {
          Outer out = new Outer();
          out.callInner();
  
      }
  }
  </code></pre>
  
  <p>Why does it compile?</p>
  
  <p>Thanks a lot!</p>