fork(1) download
  1. import java.util.ArrayList;
  2. import java.util.List;
  3. import java.util.Collection;
  4.  
  5. class foo {
  6.  
  7. public static void bar(List a, Collection b){
  8. System.out.println(1);
  9. }
  10.  
  11. public static void bar(Collection a, List b){
  12. System.out.println(2);
  13. }
  14.  
  15. public static void main(String[] a){
  16. bar(new ArrayList(), new ArrayList());
  17. }
  18.  
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:16: reference to bar is ambiguous, both method bar(java.util.List,java.util.Collection) in foo and method bar(java.util.Collection,java.util.List) in foo match
 bar(new ArrayList(), new ArrayList());
 ^
1 error
stdout
Standard output is empty