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 dynamic dispatch in java?

Answer Posted / jamia hamdard

Dynamic method dispatch is polymorphism!

we create object dynamically like:

animal ani = new animal();

If there are two different classes 'dog' and 'horse' that inherit from the class 'animal', then we can assign the 'object' of these two classes to the reference variable 'ani' made above. like:-

animal ani = new dog();//since dog inherits from animal.
or
animal ani2 = new horse();//since horse inherits from animal.

polymorphism is same name and having different signatures like 'dog' and 'horse' both are animals.
Its use is to make polymorphic arrays which stores Objects of different classes. The type of the array is that of the 'super class' which is 'animal' here.

thanks!!

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is byte code and why is it important to java’s use for internet programming?

1048


What is static import in java?

940


What is a stringbuilder?

856


What is definition and declaration?

965


How do you take thread dump in java?

942


Name some OOPS Concepts in Java?

1019


What do you mean by a JVM?

1141


What will be the default values of all the elements of an array defined as an instance variable?

985


Add a value x to array from index l to r where 0 <= l <= r <= n-1

1023


What are disadvantages of java?

958


What does it mean to be immutable?

919


What is the difference between serial and throughput garbage collector?

1031


What is meant by string is immutable?

1000


Is string is a class in java?

893


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

953