author and iconoclast
posted 7 years ago
The compiler will choose the "most specific" method. Because String is a subclass of Object, there's a clear choice between the first two methods; a subclass is deemed to be "more specific" than the superclass. But in your second example, String and StringBuffer are both subclasses of Object, so neither is more specific than the other; there's no clear choice, so it's a compile-time error.