answersLogoWhite

0


Best Answer

In Java, int is a primitive data type that is used to hold numeric values. for example an int variable can be used to hold your age in a Java program.

Integer is the Wrapper class for the int data type. In Java there are a lot of in built features that work only on objects. under such circumstances we can wrap the primitive data type in its wrapper and use it.

For example:

int x = 10;

Integer xObj = newInteger(x);

if you want to know the value contained in xObj, then we use the method intValue().

xObj.intValue() would return the value 10 contained in it.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Would you explain diff between int and integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp