The below line gives me error :
Incompatible Types.
List<List<Integer>> output = new ArrayList<ArrayList<Integer>>();
What is the reason?
EDIT
I understand if I change my second ArrayList to List, it does not give me error. I want to know the reason of error though. Thanks
This is a common misunderstanding when it comes to programming with generics, but it is an important concept to learn.
Box<Integer>
is not a subtype of Box even though Integer is a subtype of Number.