Int and integer

What is the difference between int and integer?

Showing Answers 1 - 9 of 9 Answers

Hasan

  • Oct 24th, 2005
 

int is a primitive datatype like char,float,double, boolean, short, long. Integer is a wrapper class. Every primitive data type is having its own wrapper class like Float, Double,Boolean,Long, Character, Short

Raghavendra

  • Oct 28th, 2005
 

int is in primitive data type and integer is an object or an wrapper class type of data and ex used in vectors.

  Was this answer useful?  Yes

Anitha

  • Nov 2nd, 2005
 

int is a primitive data type where as Integer is a wrapper class.

  Was this answer useful?  Yes

satheesh

  • Nov 14th, 2005
 

int is a primitive datatype Integer isa Wrapper class .Integer is similar to object .when u have to send or get an int as an object u use Integer eg:int i = 10;display(new Integer(i))

  Was this answer useful?  Yes

kunal

  • Sep 27th, 2007
 

Integer is a class while int is a premitive data type..
we use new operator in the case of integer,because class is Reference type variable.
ex- integer i=new integer();
int a=10;

  Was this answer useful?  Yes

manistays

  • Jan 19th, 2010
 

int is a primitive data type.
Integer is a Wrapper class for int data type.
Moreover, primitive data types are mutable where as Object of Wrapper class are not.
Considering performance, primitive data types are faster than Wrapper class objects.

  Was this answer useful?  Yes

raghuBavani

  • Jan 20th, 2010
 

An int in Java is primitive type data type and Integer is an object. You have to use wrapper class to convert the int to an Integer object.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions