What is the difference between Integer and int?
Answer Posted / 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 |
Post New Answer View All Answers
Which variable is the independent variable?
What is final keyword in java? Give an example.
What is the main function in java?
What is the difference between overriding and overloading in OOPS.
What is static method with example?
Is a string literal?
What is equals method in java?
What is flag in java?
What is static keyword?
Why parameters should be passed by reference?
What is matcher in java?
What does this mean java?
Java.util.regex consists of which classes?
Why does my function print none?
How does linkedlist work in java?