what is meant by UP& DOWN casting in java?

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


Please Help Members By Posting Answers For Below Questions

How many types of java are there?

564


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

623


How do you know if a value is nan?

570


Can we override the overloaded method?

568


Is constructor inherited?

535






What are void methods?

572


How will you load a specific locale?

540


What are the main differences between notify and notifyAll in Java?

584


When do you call copy constructor?

559


What are 5 boolean operators?

623


Explain when classnotfoundexception will be raised ?

569


What is 16 bits called?

503


Do I need java for windows 10?

553


What is the use of object and class classes?

571


which is advanced deep technology in java launched by the sun microsystem??? The answer is very logical If u need correct answer mail me at priya_gupta@gmail.com

3195