If there are no compile time binding in java, do this mean all binding are done at runtime?
But as per OOPs concept for runtime binding, functions must have virtual keyword..ARE all methods implicitly virtual in java or is there any compile time binding exist in java
If there is any compile time binding, can you give me some specific situation, or links to further information
- Static (There is no meaning of binding here as static does not belongs to object)
- final (this is not a valid point as it can be achived in another way)
All non-
static, non-finaland non-privatemethods are virtual by default in Java. However JVM is clever enough to find classes having only one implementation of given method and turn it into static binding.This way you don’t have to remember about
virtualkeyword (ever experienced memory leak due to missingvirtualon destructor in C++?) while the performance is not impacted that much.