Created
September 16, 2011 16:43
-
-
Save frsyuki/1222514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.InputStream; | |
public class X { | |
public static void main(String[] args) { | |
new X().write(null); | |
// ^ | |
// X.java:5: reference to write is ambiguous, both method write(java.lang.String) in X and method write(java.io.InputStream) in X match | |
} | |
public void write(Object o) { | |
System.out.println("Object"); | |
} | |
public void write(String o) { | |
System.out.println("String"); | |
} | |
public void write(InputStream o) { | |
System.out.println("InputStream"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Y { | |
public static void main(String[] args) { | |
new Y().write(null); | |
// => "String" | |
} | |
public void write(Object o) { | |
System.out.println("Object"); | |
} | |
public void write(String o) { | |
System.out.println("String"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment