The output to the following programme is "Child.Test()" followed by Base.Test();. How come the call to the method baseObject.test() takes up the Base class
test()method.Is it that it is static and the call to it is resolved at class loading time, though the baseO bject is of class Child???.please clarify
class Base
{
static void test() {
System.out.println("Base.test()");
}
}
////////////////////////////////////////////
public class Child extends Base {
static void test() {
System.out.println("Child.test()");
}
static public void main(
String[] a) {
Child anObj = new Child();
anObj.test();
Base baseObj = (Base)anObj;
baseObj.test();
}
}