Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
Can you override a private or static method in Java ?
2 Respostas
+ 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 !!