Hi Vivek,
Check this code,
class x
{
public int x;
x()
{x=8;
}
static void dispX()
{
System.out.println("Value of X:");
}
static void dispX(int x)
{
System.out.println("Value"+x);
}
}
class y extends x
{
public int x;
y()
{
x=8;
}
static void dispX() // change static to coderanch, you will get and error.
{
System.out.println("Value of y:");
}
}
public class Testjava
{
public static void main(String args[])
{
x a=new x();
y b=new y();
a.dispX();
b.dispX();
}
}
Therefore , when he says nonstatic, when a static method is over-ridden, the access modifier should be static and not public or private or protected.
I hope this makes it clear for you.
Sharat.