Why is it possible to get access to the static method of my super class from child instance?
public class Test {
public static void main(String[] args) {
new UtilImpl().fun();
new AbstractUtil() {}.fun();
}
static abstract class AbstractUtil {
public static void fun() {
System.out.println("Fun!");
}
}
static class UtilImpl extends AbstractUtil {
}
}
I can agree with access to the static method of parent class from an instance of the parent class. But if I instantiate a child class, it's weird to have access to the static context of the parent class.
PS
And what are advantages of calling the static method on instance?