+ 2
Can you override a private or static method in Java ?
2 Answers
+ 18
No, a private method cannot beoverridden since it is not visible from any other class. You have declared a new method for your subclass that has no relation to the superclass method. One way to look at it is to ask yourself whether it would be legal to write super.func() in the Derived class.
Static methods cannot be overridden because they are not dispatched on the object instance at runtime. The compiler decides which method gets called. ... No,Static methods can't be overriden as it is part of a class rather than an object. But one can overloadstatic method.
:-D
+ 4
out of topic :
@Dayve
I'm super exciting , can't wait to see you reaching Level 16 with platinum !!