What is the difference between Integer and int?

Answers were Sorted based on User's Feedback



What is the difference between Integer and int?..

Answer / janet

Integer is a class defined in the java.lang package,where
as int is a primitive data tyep defined in the java
language itself.Java doesn't automatically convert from one
to the other.
Integer can be used as an argument for a method that
requires an object,where as int can be used for
calculations.

Is This Answer Correct ?    59 Yes 9 No

What is the difference between Integer and int?..

Answer / k.santosh kumar

int is a primitive data type , where as Integer is a class
which encapsulates the primitive int data type and
represents in terms of object.

Is This Answer Correct ?    35 Yes 6 No

What is the difference between Integer and int?..

Answer / ravikiran(aptech mumbai)

Integer is a wrapper class object where as int is a
primitive datatype

Is This Answer Correct ?    31 Yes 4 No

What is the difference between Integer and int?..

Answer / devendra

An int is a primitive. It is not an Object.int variables
are mutable. Unless you mark them final, you can change
their value at any time.
An Integer, is a Object that contains a single int
field.Integers are immutable. If you want to affect the
value of a Integer variable, the only way is to create a
new Integer object and discard the old one.

Converting
// to int i from Integer ii
int i = ii.intValue();

// to Integer ii from int i
Integer ii = new Integer( i );

Is This Answer Correct ?    27 Yes 3 No

What is the difference between Integer and int?..

Answer / sumit

int is a premitive data type and integer is a class

Is This Answer Correct ?    14 Yes 7 No

What is the difference between Integer and int?..

Answer / duryodhan

int is a primitive data type & integer is a wapper class object which define in java.lang package.

Is This Answer Correct ?    4 Yes 1 No

What is the difference between Integer and int?..

Answer / abc

y = 10; is int i=new Integer(4); correct??

Is This Answer Correct ?    6 Yes 4 No

What is the difference between Integer and int?..

Answer / maninder sharma

Integer is a class defined in the java.lang package,where
as int is a primitive data type.

Is This Answer Correct ?    1 Yes 0 No

What is the difference between Integer and int?..

Answer / tapan kumar

int is a primitive type by the int we can set and read the
value but Integer is a wrapper class type u can use for
finding the length and for size .

Is This Answer Correct ?    4 Yes 4 No

What is the difference between Integer and int?..

Answer / krutika

y is int i=new Integer(4); correct??

Is This Answer Correct ?    3 Yes 14 No

Post New Answer

More Core Java Interview Questions

What technique is carried out to find out if a particular string is empty?

0 Answers  


Why do we need wrapper class?

0 Answers  


I have a sorting issue with a Hashmap. My constraint is that I MUST use the Hashmap and work with existing code. I do a database query and place the results in a Hashmap. When I iterate thru the Hashmap, it loses the original alphabetical sorting done by the database. So, my problem is that I must sort the results coming out of the Hashmap which is then placed into another class.

1 Answers  


for(i=0;i<100;i++) { int i=method();//method returns no's from 1 to 10; /* insert some stmts which can give output like no.of times numbers(1-10) returned. (for example if it returns 2 then i want output how many times 2 returned) like that i want output for no's 1 - 10 how many times each no returned. */ }

3 Answers  


Is main a keyword in java?

0 Answers  


What do you understand by classes in java?

0 Answers  


make a method which any number and any type of argument and print sum of that arguments.....

0 Answers  


Which is bigger float or double java?

0 Answers  


can u handle an error if u write Thowable in the catch class lise try { some errorneous code }catch(Throwable e){ ...}

4 Answers  


what are the methods in object?

0 Answers   IBS,


What is default size of arraylist in java?

0 Answers  


What is internal variable?

0 Answers  


Categories