Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is a null class?

973


Explain about anonymous inner classes in java?

1072


Can string be considered as a keyword?

1028


Can java cast null?

1033


What is the structure of java?

1018


Explain how can you debug the Java code?

1060


Can you write a java class that could be used both as an applet as well as an application?

951


What is the purpose of skeleton and stub?

1225


How many classes can any class inherit java?

961


Is java a compiler?

969


is there a separate stack for each thread in java? : Java thread

968


How do listeners work?

1027


What is the method overriding?

1080


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?

1245


What does a boolean method return?

1221