This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes about dynamic binding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about dynamic binding" Watch "about dynamic binding" New topic
Author

about dynamic binding

Roger Zhao
Ranch Hand

Joined: Aug 05, 2003
Posts: 73
Hi,
My puzzles about the following example:
class Base {
void speak() { /*
System.out.println("Base"); /*
} /*
}
class Sub extends Base {
void speak() {
System.out.println("Sub");
}
}
public class Test9{
public static void main(String argv[]){
Base b = new Sub();
b.speak();
}
}
It shows "Sub" when run it. why?
Is it result of "dynamic binding"?
Thanks.


"There is a will,there is a way!"<br />SCJP1.4
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi roger
that is a result of dynamic binding. u r correct.
regards
maulin
Roger Zhao
Ranch Hand

Joined: Aug 05, 2003
Posts: 73
Thanks,Vasavada.
How can I find some help infor or learning materials about Java Dynamic binding, I really wanna know more about such subject.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can check out this
Javaranch Campfire Stories
This should also give you a hint about late binding
 
Have you checked out Aspose?
 
subject: about dynamic binding
 
It's not a secret anymore!