This post is just for information which i found very useful. First go throgh the difference between Overriding and Hidding @ OverridingVsHiding. Once this is clear.Now remember final keyword when applied to instance methods does not allow instance methods to be overriden by sub classes which we all know. You can also apply final keyword to static methods which means static method in subclass that was earlier hiding the static method in parent class will now be disallowed by compiler.
Also note that all legal rules of overriding applies to hiding as well. Can someone confirm this statement? I tried and found it to be legal
is legal but
causes compiler error. Thanks Deepak
[ November 30, 2007: Message edited by: Deepak Jain ] [ November 30, 2007: Message edited by: Deepak Jain ]
Also note that all legal rules of overriding applies to hiding as well.
I would agree. There are other things that work the same with static and instance method. I think of access modifiers (don't have less access in hidden/overridden methods). Or Exceptions (don't throw broader exceptions).
You can even use the @Override annotation when hiding a static method.
all events occur in real time
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop