If I have the following:
class A {
public A() { }
public static void foo() { System.out.println("foo() called"); }
}
public class Main {
public static void main(String [] args) {
A a = new A();
a.foo(); // <-- static call using an instance.
A.foo(); // <-- static call using class
}
}
Are there any problems that may arise from calling foo() using an instance? Does the JVM treat the first call to foo() exactly as a static method, or is there some technical subtlety?