why i am getting ClassCastException in this case
<p>Please tell me why i am getting ClassCastException in this case </p>

<p><strong>I have type casted , the source of B class to A as shown below , but why i am still getting ClassCastException here .</strong></p>

<pre><code>public class A extends B 
{


}

public class B {
    public String getData() {
        return "B";
    }
}


public class Main {
    public static void main(String args[]) {
        A a = new A();
        B b = new B();
        a = (A) b;
        System.out.println(a.getData());
    }
}
</code></pre>
