A basic explanation is an int
is a primitive data type and literally is only a value stored in memory. An Integer
is a Java object that wraps an int
in a Class with lots of nice/helpful methods that can be called to work with that backing int
hidden inside. This is the same with most of the primitive data types, such as boolean
and Boolean
, char
and Character
, etc. This is refereed to as Boxing
a primitive. Unboxing being the opposite, taking an Object and extracting the backing primative.
Here's an example of how one may use Integer
to convert a String
into an int
(boxed to an Integer
)
String someString = "10";
Integer intObj = Integer.parseInt(someString);
System.out.println(intObj.toString());
You'll find that some of the data types have more helpful methods than others. Check the JavaDoc's for each of the types you are interested in, there are a lot of goodies in there!