posted 14 years ago
for this program
class rajan
{
public static void sum()
{
System.out.println("i am base class");
}
}
class erode extends rajan
{
public static void sum()
{
System.out.println("i am derived class");
}
}
class rajanerode
{
public static void main(String args[])
{
erode e=new erode();
e.sum();
}
}
method from class erode will get called .
A static method cannot override an inherited instance method, but it can hide a static method if the exact requirements for overriding
instance methods are fulfilled. A hidden superclass static method is not inherited. The compiler will flag an error if the signatures are the
same but the other requirements regarding return type, throws clause, and accessibility are not met. If the signatures are different, the
method name is overloaded, not hidden.
let me know if you have any quires.