Created
November 30, 2011 21:56
-
-
Save lazywithclass/1411161 to your computer and use it in GitHub Desktop.
Array covariance
This file contains 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 Test { | |
class Parent {} | |
class Child extends Parent {} | |
public void accept(Parent[] parent) { | |
System.out.println("accepted"); | |
} | |
public static void main(String[] args) { | |
Test test = new Test(); | |
test.accept(new Child[10]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment