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
What is exception propagation?
What is Enum in Java?
What is native method in java?
What is the purpose of using javap?
what is collatration?
How do you call a reference in java?
What are latest features introduced with java 8?
What is difference between variable declaration and definition?
Write an algorithm for quick sort?
Is a case study a method or methodology?
Why for each loop is used?
Can you extend singleton class?
I want to persist data of objects for later use. What’s the best approach to do so?
What is the final keyword?
Can we declare main () method as non static?