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 a null class?
Explain about anonymous inner classes in java?
Can string be considered as a keyword?
Can java cast null?
What is the structure of java?
Explain how can you debug the Java code?
Can you write a java class that could be used both as an applet as well as an application?
What is the purpose of skeleton and stub?
How many classes can any class inherit java?
Is java a compiler?
is there a separate stack for each thread in java? : Java thread
How do listeners work?
What is the method overriding?
If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?
What does a boolean method return?