Alright so I just want to confirm something.
I am creating a wrapper class for java’s Properties class and I came a cross a little question.
if I have
public static void set(String key, Object value) { _p.set(key, value.toString()); }
and
public static void set(String key, SomeClass value) { _p.set(key, value.SomeMethod().toString()); }
is the Object overload called only when none of the other overloads suffice?
Java will choose the most specific match, in your case a boolean will be automatically converted using auto-boxing boolean <-> Boolean. If you use any other type like String the Object variant will be used.
The Details you find in the Java Language
Specification
see 8.4.9 Overloading
Added in response to comment:
You can easily test the behaviour with some code like:
Prints:
I hope now it is more clear what happens.