Let\'s say I have the following setup
class A { B foo(); } class C extends B { } // later A a = new A(); C theFoo = (C)a.foo();
We k
Method call has a higher operator precedence than type casting, so (C) a.foo() will first call a.foo() and cast the result to type C. In contrast, ((C) a).foo() first casts a to type C and then calls its foo() method.
(C) a.foo()
a.foo()
C
((C) a).foo()
a
foo()