What is the difference between int and Integer ?

Well, int is a "primitive type" of the language while Integer is a defined class type (the class is defined in the file java/lang/Integer.java). So if you declare
	Integer n = new Integer(2)
	
you are really getting an object (named "n"). Integer is basically a "wrapper" around the int type.

Sometimes, your code needs an object, and you cannot use a primitive type. In this case, you first create the corresponding Integer object.

There are similar wrappers for the other primitive types.