public class B {
static int i =1;
public static int multiply(int a,int b)
{
return i;
}
public int multiply1(int a,int b)
{
return i;
}
public static void main(String args[])
{
B b = new A();
System.out.println(b.multiply(5,2));
System.out.println(b.multiply1(5,2));
}
}
class A extends B
{
static int i =8;
public static int multiply(int a,int b)
{
return 5*i;
}
public int multiply1(int a,int b)
{
return 5*i;
}
}
Output:
1
40
Why is it so? Please explain.