I tried to run the below code
List<? extends Object> list = new ArrayList<Integer>();
list.add(1); //compile error
list.add("abb");//compile error
I understand we can't add anything to above list. Then what is the purpose of creating a list in this way ?
What is the reason java allowed us to create a list this way ?
Thanks