title: How is it possible to create instance outside class of local inner class having private constructor?
body: <p>Consider the following program:</p>
  
  <pre><code>public class A
  {
      public static void main(String[] args)
      {
          class B
          {
              private B()
              {
                  System.out.println("local");
              }
          }
      // how are we able to create the object of the class having private constructor
      // of this class.
      B b1= new B();
      System.out.println("main");
      }
  }
  </code></pre>
  
  <p>Output:
  local
  main</p>
  
  <p>A class having private constructor means we can create object inside the class only, but here am able to create instance outside the class. can someone explain how are we able to create the object of B outside class B??</p>