title: Why can't I use protected constructors outside the package?
body: <p>Why can't I use protected constructors outside the package for this piece of code:</p>
  
  <pre><code>package code;
  public class Example{
      protected Example(){}
      ...
  }
  </code></pre>
  
  <p>Check.java</p>
  
  <pre><code>package test;
  public class Check extends Example {
    void m1() {
       Example ex=new Example(); //compilation error
    }
  }
  </code></pre>
  
  <ol>
  <li>Why do i get the error even though i have extended the class?
  Please explain</li>
  </ol>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Compilation error:</p>
  
  <blockquote>
    <p>The constructor Example() is not visible</p>
  </blockquote>