public class TestClass1 {
public static void main(String[] args) {
show(null); // The method show(String) is ambiguous for the type TestClass1
}
private static void show(String str) {
System.out.println("String str");
}
private static void show(int[] str) {
System.out.println("int[] str");
}
}
-----------------------------------------------------------------------------------------
public class TestClass1 {
public static void main(String[] args) {
show(null);
}
private static void show(String str) {
System.out.println("String str");
}
private static void show(Object str) {
System.out.println("int[] str");
}
}
Output : String str
No comments:
Post a Comment