01. Integer can be null. But int cannot be null.
Integer value1 = null; //OK
int value2 = null //Error
02. Only can pass Wrapper Classes type values to any collection class.
(Wrapper Classes - Boolean,Character,Byte,Short,Integer,Long,Float,Double)
List<Integer> element = new ArrayList<>();
int valueInt = 10;
Integer valueInteger = new Integer(value);
element.add(valueInteger);
But normally we add primitive values to collection class? Is point 02 correct?
List<Integer> element = new ArrayList<>();
element.add(5);
Yes 02 is correct, beacouse autoboxing.
Autoboxing is the automatic conversion that the java compiler makes between the primitive type and their corresponding wrapper class.
Then 5 convert as Integer value by autoboxing.