Answer Posted / sabeetha
Down Casting is nothing but casting down the inheritance
tree to a more specific class i.e casting a superclass to
subclass.
Upcasting- casting up the inheritance tree to a more general
type. It is done implicitly (i.e typing in the cast is not
required). Its because the classes at lower level of
hierarchy have all those features that are present in the
classes above them in the inheritance hierarchy. So they can
be upcasted implicitly ( like Dog IS-A Animal).
I got this answer
from(http://javaforyou.wordpress.com/2008/06/22/casting-reference-variables-downcasting-upcasting/)
with example.
| Is This Answer Correct ? | 19 Yes | 2 No |
Post New Answer View All Answers
Is it possible for a yielded thread to get chance for its execution again?
How does hashmap work in java ?
What is the difference between the size and capacity of a vector?
What is outofmemoryerror in java?
Is hashset ordered?
What is thread pool in java with example?
What is the advantage of OOP in java?
What is callable java?
What is regex in java?
Can I uninstall java?
What is the difference between preemptive scheduling and time slicing?
What is the definition of tree ?
What is parsing in java?
Is simpledateformat safe to use in the multithreaded program?
What is the equal sign?