class A
{
public static void func(int a)
{
System.out.println("In A : "+a);
}
}
class B extends A
{
public static void func(int a)
{
System.out.println("In B : "+a);
}
}
public class StaticExample
{
public static void main(String args[])
{
A a = new A();
A aa = new B();
B b = new B();
a.func(1);
aa.func(2);
b.func(3);
}
}
Why the output for the above code is
In A : 1
In A : 2
In B : 3
What I have read is that static methods cannot be overridden, then why such output is coming?