In An Introduction To Generics we learned about declaring and using generics. In this part of the tutorial we are going to learn polymorphism with generics. Consider this declarations.
List<String> strings = new ArrayList<String>(); // This is valid
List<Object> objects = new ArrayList<String>(); // This is not valid
List is the base type. String is the generic type ArrayList…