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 java 1.7 the same as java 7?
How many bytes are a float?
What is ascii format?
Write a program to check string is palindrome without using loop?
What are the advantages of java inner classes?
How do you detect memory leaks?
How do you define a variable?
What is the intersection and union methods?
What are different access specifiers in java? Explain
Why java is secure? Explain.
Is char a method in java?
What is a vector in java?
What is the use of optional ?
What do heavy weight components mean in java programming?
What are bind parameters?