1An int is a 32-bit integer; a long is a 64-bit integer. Which one to use depends on how large the numbers are that you expect to work with.
2
3int and long are primitive types, while Integer and Long are objects.
4
5 Primitive types are more efficient, but sometimes you need to use objects;
6for example, Java's collection classes can only work with objects,
7so if you need a list of integers you have to make it a List<Integer>, for example (you can't use int in a List directly).