File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Dynamic dispatch?????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Dynamic dispatch??????" Watch "Dynamic dispatch??????" New topic

Dynamic dispatch??????

Niyas Ahmed Sheikh
Ranch Hand

Joined: Jun 15, 2005
Posts: 129
What is Dynamic Dispatch in Java?
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
Do you understand what dynamic dispatch is and just want to know how to implement it in Java, or do you want to know what dynamic dispatch is ?

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Google is your friend. Search for "Dynamic Dispatch". I tried to paste the resulting URL in here but it turned into emoticons instead of a url.

The WikiPedia is pretty amazing, but their article on dynamic dispatch doesn't have Java!
[ October 03, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Naveen Vooka

Joined: Oct 13, 2004
Posts: 25

Naveen Vooka
DevSquare - Online Application Development
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I think those links are trying to sell you something ... a framework that makes Java simulate multiple inheritance. They rendered so poorly on Firefox that I didn't try very hard to figure it out.

Dynamic dispatch is the fundamental language feature that enables runtime polymorphism. When I code a method call on a variable declared as an interface there is no code present at compile time to be called. At runtime the JVM routes the call to the actual class of the object referenced by the variable.

List books = getBooks();

List promises that a method size() exists but doesn't implement it. Some concrete class like LinkedList implements it and the JVM does "dynamic dispatch" to the concrete method.
subject: Dynamic dispatch??????
It's not a secret anymore!