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 are upcasting and downcasting?

Answer Posted / vikram aditya

When reference variable of super class refers to the object of sub class that mechanism is known as Up-casting.
Ex:
A a=new B();

When reference variable of sub class refers to the object of super class that mechanism is known as Down-casting.
Ex:
B b=(B) a;

//Where A is super class and B is subclass
 

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is extension method in java?

1092


What do you mean by synchronized non access modifier?

1051


Is empty .java file name a valid source file name?

1184


What is the syntax and characteristics of a lambda expression?

1099


A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

1063


Is 0 a real number?

1105


Explain restrictions for using anonymous inner classes?

1145


Can a constructor have different name than a class name in java?

1285


What are different exception types exceptions available in java ?

1056


How do you override a variable in java?

1244


What is the range of a character variable?

1051


Why main method is called first in java?

1061


Give the difference between the println method and sqrt method?

1136


How many ways can an argument be passed to a subroutine and explain them?

1082


What is array initialization in java?

1184