Tuesday, 17 January 2017

Can we Override static methods in java?

We can declare static methods with same signature in subclass, but it is not considered overriding as there won’t be any run-time polymorphism. Hence the answer is ‘No’.

If a derived class defines a static method with same signature as a static method in base class, the method in the derived class hides the method in the base class.


No comments:

Post a Comment