Casting in Java
<p>If I have class <code>A</code> that have a method <code>foo()</code> and a class <code>B</code> that extends from <code>A</code> and overrides <code>foo()</code>. If I write <code>A a= new B();</code> and than I write <code>((A) a).foo()</code>- which <code>foo</code> is going to be activated? on one hand The dynamic type is <code>B</code> and <code>foo()</code> was well overridden, on the other hand- does this cast makes a to be a dynamic type of <code>A</code>?</p>
