Polymorphism for Java method is always there except the following three situations:
The method is declared as final
The method is declared as private
The method is declared as static
In those three cases, static binding will be performed by the compiler. Compiler does not have the knowledge, nor care about the method was, is, or will be overridden by none, one, or many subclass(es). The decision is made by the runtime, which is called dynamic binding.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment