PROGRAM 1
-------------------------
Consider PROGRAM 2
---------------------------
Is this because that in case of PROGRAM 1, the classes
String and StringBuffer are Peer - classes, therefore because of this it appears as a ambiguious call to compiler.
But in case of PROGRAM 2 where String and Object class references (where both are not peer classes) are used as the parameters in the methods, String being more specific is being selected and executed.
Well, i am not sure about the above reason, as its just a gut feeling. Pls guide me if i am wrong.