This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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

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

about dynamic binding

Roger Zhao
Ranch Hand

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

"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.
Roger Zhao
Ranch Hand

Joined: Aug 05, 2003
Posts: 73
How can I find some help infor or learning materials about Java Dynamic binding, I really wanna know more about such subject.
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
Consider Paul's rocket mass heater.
subject: about dynamic binding
It's not a secret anymore!