aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 1871
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about dynamic binding
 
Similar Threads
Constructors and inheritance
Abstract classes
Differance in overriding variable and method
Dynamic Binding
Constructor initialization