I do not understand this Java behavior. I have two classes:
class C1 {
public void m1(double num) {
System.out.println(\"Inside C1.m1(): \" + num
Your two methods named m1 do not have the same signature; the one in the superclass takes a double, and the one in the subclass takes an int. This means that the compiler will select the method signature to call based on the compile-time type of your variable, which is C1, and will call m1(double). Since at runtime the class C2 doesn't have an overriding version of m1(double), the version from C1 is invoked.
The rule is that method signatures are computed at compile time based on compile-time types; method calls are dispatched at runtime based on matching signatures.