title: Java Sub Class List Can NOT be Returned As Super Class List
body: <p>It is about inheritance.<br/>
  Now I have two classes,</p>
  
  <ol>
  <li><p>Super Class</p>
  
  <pre><code>public class TestSuper {}
  </code></pre></li>
  <li><p>Sub Class</p>
  
  <pre><code>public class TestSub extends TestSuper{
  
      private TestSub testSub;
      private List&lt;TestSub&gt; testSubList;
  
      public TestSuper getTestStub(){
          return testSub;
      }
  
      public List&lt;TestSuper&gt; getTestStubList() {
          //compile error here
          return testSubList;
      }
  }
  </code></pre></li>
  </ol>
  
  <p>I can NOT return <code>testSubList</code>, the error is <code>Type mismatch: cannot convert from List&lt;TestSub&gt; to List&lt;TestSuper&gt;</code>. But why can I return <code>testSub</code>?</p>