Hi all,
I have a question:
snippet 1/
class Horse {
void print(
String s) {
}
void print(StringBuffer s) {
System.out.println("s");
}
public static void main(String[] args) {
Horse a = new Horse();
a.print(null);
}
}
snippet 2/
class Horse {
void print(Object s) {
}
void print(StringBuffer s) {
System.out.println("s");
}
public static void main(String[] args) {
Horse a = new Horse();
a.print(null);
}
}
Why does snippet2 compile fine, and not snippet1
?
Thanks for all your answers and explanations.
Manu.