> What's the practical difference between overriding an abstract method > and implementing an interface method?
The answer to this question is actually quite interesting. The difference is that abstract methods can get preallocated method slots and thus can be invoked with a constant slot (invokevirtual) whereas interface methods (invokeinterface) can be implemented by unrelated classes so a method call on the interface method (and via interface type) needs to scan the object's method table. There's some info about it here: http://stackoverflow.com/questions/1504633/what-is-the-point-of-invokeinterface This is true until the jit collects enough statistics (or prior knowledge) to remove interface/ virtual methods entirely (if possible). The above aside, my +1 for @Override on interface methods. It helped me a number of times to detect dead methods when refactoring interfaces. D. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
