int and Integer have exactly the same accuracy, 32 bits.
Integer is the same as int, except that Integer comes in a really nice box. The box is so nice that it costs 3 times as much as the product inside.
If we want to use a parameterized Java container such as ArrayList, we must use Integer: only a reference type can be used as a type parameter.
Integer also has useful methods. Only a reference type can have methods.
int is a low-cost, bare-bones integer, which is useful for local variables within the program and cases where there is a large array and we want to save storage.
Prev Next Page+10