I\'ve been reading a section on Statics in the SCJP study guide, and it mentions the following :
static methods can\'t be overridden, but they can be r
It simply means that the functions are not virtual. As an example, say that you have an object of (runtime) type Child which is referenced from a variable of type Parent. Then if you invoke doSomething
, the doSomething
method of the Parent is invoked:
Parent p = new Child();
p.doSomething(); //Invokes Parent.doSomething
If the methods were non-static, doSomething
of Child would override that of Parent and child.doSomething
would have been invoked.
The same holds for static fields.