Regarding casting
<p>I was doing a short research on type casting , below is the mine code</p>

<pre><code>interface Foo {}
class Alpha implements Foo {}
class Beta extends Alpha {}

public class Delta extends Beta
{
    public static void main( String[] args )
 {      
        Beta x = new Beta();         
         Alpha a = x;
            // Foo f = (Alpha)x;// --&gt; commented out
         Beta b = (Beta)(Alpha)x;   
         Foo f = (Delta)x; //  --&gt; complie time error   

    }

}
</code></pre>

<p>As indicated in the last statement it throws a run time error java.lang.ClassCas tException, please advise and if I cast it with Alpha then it works perfectly fine.</p>
