title: multiple classes in a single file : modifier private not allowed here
body: <p>I am not able to understand why this code doesn't compile:</p>
  
  <pre><code>class A {
      public static void main(String[] args) {
          System.out.println("hi");
      }
  }
  
  private class B {
      int a;
  }
  </code></pre>
  
  <p>I am saving the contents in a file named <code>A.java</code> - and I get an error:</p>
  
  <pre><code>modifier private not allowed here // where I have defined class B
  </code></pre>
  
  <p>This happens both when I try B as private and protected. Can someone please explain me the reason behind this?</p>
  
  <p>Thanks !</p>