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;
The a is autoboxed to an Integer. From the link,
a
Integer
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes.