Hi,
When I execute the foll code, the output is 10 & sub.Can anyone please explain?
Thanks in Advance,
Usha.
class A
{
int i = 10;
void method (){ System.out.println ("Super"); }
}
class B extends A
{
int i = 12;
void method () { System.out.println("Sub"); }
}
public class
test {
public static void main (
String args[ ])
{
A obj = new B();
System.out.println(obj.i);
obj.method();
}
}