Upcasting and downcasting in Java
- 19th Mar 2014
- 12
- 74873
- can we do downcasting directly ? How can we achieve downcasting in java method binding at runtime upcasting and downcasting in java variable binding at complie time Variables are binding at completime
Casting : Taking an object of one type and assigning it to reference variable of another type. Upcasting : Object of child class is assigned to reference varibale of parent type. Example : class A{ } class B extend A{ } class A{ } class B extend A{ } A a1 […]