I know in Java, static
method can not be overriden by the subclass.
Two questions:
1. Why is that? Could anyone explain me the reason inside it?
2. Can subclass override final
method in super class then?
I know in Java, static
method can not be overriden by the subclass.
Two questions:
1. Why is that? Could anyone explain me the reason inside it?
2. Can subclass override final
method in super class then?
Static methods aren't called on a particular instance - so they can't be called polymorphically. They are called on the type itself - nothing about the binding relies on any information which is only available at execution time. The point about polymorphic calls is that the method implementation which ends up being executed depends on the execution-time type of the target of the call; there's no target for static method calls, as such.
No, subclasses can't override final methods - the whole point of making a method final is to prevent it from being overridden.