Hello Friends,
This is not method overriding. You just declared two methods in the super class and sub class with the same name. The rule is STATIC METHODS CANNOT BE OVERRIDDEN.
In the given scenario the compiler considers about type of the referance, not the actual object assigned to it.
You can call static methods by using the class name.
If you want to print "Hello in 1st static method" -- use over.disp();
If you want to print "Hi in 2nd static method " -- overridedemo.disp();
Lakmal,
---------
SCJP 1.4 SCWCD 5.0