I have a very stupid question here. When we add an int value to an ArrayList, will it create a new Integer object of that int value? For example:
int a = 1;
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(a);
In the code above, 'a' is a primitive type which has value 1, 'list' is an arraylist which contains elements of Integer type. So when adding 'a' to 'list', how does 'list' treat 'a' as an Integer?