This has been asked many times. The compiler chooses the most specific method for the job and here the most specific is the one that takes String argument. The rule for choosing the most specific method is that, one method is more specific than the other if any argument that the methodtakes can be easily passed to the other method without any compilation errors. Here any argument that you can pass to a String can be passed to the method that takes Object as argument. But the vice versa is not true. Hence you get this O/P as String.