fork download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. new Bar(new Baz());
  4. }
  5. }
  6.  
  7. interface Foo {}
  8.  
  9. class Bar {
  10. public Bar() {}
  11.  
  12. public Bar(Bar other) {}
  13.  
  14. public Bar(Foo other) {}
  15. }
  16.  
  17. class Baz extends Bar implements Foo {}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: reference to Bar is ambiguous
    new Bar(new Baz());
    ^
  both constructor Bar(Bar) in Bar and constructor Bar(Foo) in Bar match
1 error
stdout
Standard output is empty