Creating an array list of objects
<p>I have two classes A and B. B extends A. Now, in B, can I create an array list of objects of A.</p>

<hr>

<pre><code>public class A {

      // class fields
      // class methods  
}
</code></pre>

<hr>

<pre><code>import java.util.*;

public class B extends A {

List&lt;Object&gt; listname=new ArrayList&lt;Object&gt;();

A obj=new A();
listname.add(obj);
 }
</code></pre>

<hr>

<p>Can I create an array list of objects at all ? By the way, above code gives error !</p>
