Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.