Please tell me if my understanding is correct:
If a method is overloaded, which method to call is resolved at compile time, and the compiler will select the narrowest definition that matches the declared type of the arguments. In other words, if I have these methods:
void foo(Object obj) { ... }
void foo(String str) { ... }
And I declare a String reference and call foo with it, it will use foo(String). However, if I declare an Object reference, assign a String to it, and call foo, it will use foo(Object) because it uses the reference type, not the object type. Correct?
Really what I'm asking is if this is guaranteed, because I could just test it...