why the following down casting is not working in Java:
<pre><code>    ArrayList&lt;classA&gt; aList = /*I then fill this array*/
    ArrayList&lt;classB&gt; bList = /* I then fill this array too*/

    /*Now put them both in the following ArrayList of Objects*/
    ArrayList&lt;Object&gt; myObjs =  new ArrayList&lt;Object&gt;();
    myObjs.add(aList);
    myObjs.add(bList);

    /*The following two lines however fails at run time*/
    ArrayList&lt;classA&gt; x = (ArrayList&lt;classA&gt;) myObjs.get(0);
    ArrayList&lt;classB&gt; x = (ArrayList&lt;classB&gt;) myObjs.get(1);
</code></pre>

<p>I just read from another thread that "Downcasting is allowed when there is a possibility that it succeeds at run time "</p>

<p>can any one please tell me the problem of the above code ?
thank you very much! </p>
