Skip to content

Instantly share code, notes, and snippets.

@lazywithclass
Created November 30, 2011 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazywithclass/1411161 to your computer and use it in GitHub Desktop.
Save lazywithclass/1411161 to your computer and use it in GitHub Desktop.
Array covariance
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