hi friends, in this program given below , the print() method is inherited by the subclass. Then why does it print the value of variable s of the class Base ?
Thanx a lot
Vidya
class Base{
String s = "Base";
void print(){
System.out.println(s);
}
}
class Derived extends Base{
String s = "Derived";
}
public class
Test {
public static void main(String[] args){
Derived b = new Derived();
b.print();
System.out.println(b.s);
}
}
[ April 29, 2003: Message edited by: Vidya Venkatesh ]