Hi Harish,
Look at the following code:
code:
-----------------------------------------------------------------------
class Base{
int i=10; //1
public void display(){
System.out.println("i: "+i);
}
}
class Derived extends Base{
int i=20; //2
public void display(){
System.out.println("i: "+i);
}
public static void main(
String a[]){
Base b1=new Base();
Derived b2=new Derived();
System.out.println(b1.i); //3
System.out.println(b2.i); //4
}
}
-------------------------------------------------------------------------
Now in the above program, int declared at //1 is shadowed by integer declared at //2. Similarly method display() declared in Base is shadowed or you can say overridden by the derived class.