Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
$ cat -n Test.java 1 class Test { 2 public static void foo(int ...i) {} 3 public static void foo(double...d) {} 4 5 public static void main(String[] args) { 6 foo(1, 2, 3); 7 } 8 } 9 $ javac Test.java Test.java:6: reference to foo is ambiguous, both method foo(int...) in Test and method foo(double...) in Test match foo(1, 2, 3); ^ 1 error Javac is incorrect since int <: double which makes foo(int...) more specific than foo(double...).
|