Can anyone explain to me the effect of a method of having a static modifier and it's effect while overrriding. 1.If both the overriding and overridden methods have a static modifier. 2.Only if one the 2 methods have a static modifier.
Static methods can not be overridden, they can only be hidden. If the method in the parent is static then the method in the child must be static. If the method in the parent is not static then the child method can not be static.
A static method of a subclass can hide a static method with the same name and parameter list in the super class, but a static method can not override a superclass method. If a reference of the superclass type invokes a static method on an object of a subclass type, then the method of the superclass type is actually used--the method of the subclass is not. That's because a static method is a class method and is not bound to a particular instance of an object. Therefore, the actual type of the instance does not make any difference. In response to your second question, the result would be a compiler error.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com