Kindly, why should I supply the Generic class on the left side (variable declaration) and right side (object assignment) ? I can technically skip it left or right (see alist2, or aList2), what is the drawback of aList2 and aList3 compared to aList1 ?
ArrayList<String> aList1 = new ArrayList<String>();
ArrayList<String> aList2 = new ArrayList();
ArrayList aList3 = new ArrayList<String>();
Bonus question, just came into my mind and it compiles, but what would that mean for aList4 and aList5?
ArrayList<String> aList4 = new ArrayList<>();
ArrayList<?> aList5 = new ArrayList<String>();
Thank you in advance.
Kind regards, Hermann