This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
you are misunderstood a little bit here
static methods can definitely be overloaded
but they cannot be overridden
you can write static methods with the same name and the same method signature in two different classes but that is not
called as method overriding
this is called as method hiding
as in inheritance the static method defined in the subclass actually hides the method in the super class
burn following rules into the mind
Static methods cannot be overridden, that is called as method hiding
If super there is a static method in super class called as doStuff(), then in subclass we have to declare the method with name doStuff() as static
this is mandatory other compilation fails
the example of method hiding is as follows
This outputs as follows
If you are still unclear about the overloading and overriding of methods
then I recommend you should go through the K & B thoroughly to make it fully understand
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Joined: Aug 04, 2009
That's amazing ! What a great help !
Oh yeah, it's written in capital letters "MÉTODOS STATIC NÃO PODEM SER SOBRECARREGADOS." (static methods cannot be overloaded). I've got a portuguese version of that book, perhaps it's mistranslated. It says that it can be hidden by another implementation, as you explained.