You could do by the following way:
import java.util.ArrayList; import java.util.List; abstract class Parent { void callMe(){ System.out.println("Parent"); } } class Child extends Parent { void callMe(){ System.out.println("Child"); } } public class TestClass { public static void main(String[] args) { List<Parent> alist=new ArrayList<Parent>(); List<? super Child> alist2=alist; } } List<Parent> is not same as List<Child>. Compilor does not allow to assign the reference of List<Parent> to List<Child> even though List contains only Child Object.
For Example:
List<Parent> parentList=new ArryList<Parent>(); parentList.add(new Child()); parentList.add(new Child()); parentList.add(new Child()); //This is not allowed List<Child> childList=(List<Child>)parentList;//Compiler Error //But,This is allowed List<? super Child> childList=parentList; //Okey