(Source - Stack overflow)
Interfaces allow you to use classes across different hierarchies polymorphically. For example, say you have the following interface:
Any number of classes, across class hierarchies could implement Movable in their own specific way, yet still be used by some caller in a uniform way.So if you have the following two classes:
From the perspective of the caller, it's just a Movable
|
Search My Blog
Wednesday, June 27, 2012
runtime polymorphism using interfaces in Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment