title: Protected constructor and accessibility
body: <p>Why can't we instantiate a class with a protected constructor if its child is in a different package? If protected variables and methods can be accessed, why doesn't the same rule also apply for a protected constructor?</p>
  
  <p>pack1:</p>
  
  <pre><code>package pack1;
  
  public class A {
      private int a;
      protected int b;
      public int c;
  
      protected A() {    
          a = 10;
          b = 20;
          c = 30;
      }
  }
  </code></pre>
  
  <p>pack2:</p>
  
  <pre><code>package pack2;
  
  import pack1.A;
  
  class B extends A {
      public void test() {
          A obj = new A(); // gives compilation error; why?
          //System.out.println("print private not possible :" + a);
          System.out.println("print protected possible :" + b);
          System.out.println("print public possible :" + c);
      }
  }
  
  class C {
      public static void main(String args[]) {
          A a = new A(); // gives compilation error; why?
          B b = new B();
          b.test();
      }
  }
  </code></pre>