I have the following piece of code
public static void main(String[] args) {
ArrayList<Integer> iList = new ArrayList();
iList = returList();
for (int i = 0; i < iList.size(); i++) {
System.out.println(iList.get(i));
}
}
public static ArrayList returList() {
ArrayList al = new ArrayList();
al.add("S");
al.add(1);
return al;
}
now my query is why the Arraylist is accepting the raw arraylist object creation in line 'ArrayList iList = new ArrayList();' and the same case even from the method call return even.
Now, which type of data will be will be there and will Generics implies ? i see no compilation errors and this code is running fine even.