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
Does constructor creates the object ?
What do you understand by the term string pool?
Describe the Big-O Notation.
What is subsequence of a string?
Which oo concept is achieved by using overloading and overriding?
What is the difference between superclass and subclass?
What is difference between wait and notify in java?
Difference between final and effectively final ?
What is the use of private static?
What is sleep method?
What are the fileinputstream and fileoutputstream?
When parseint method can be used?
Explain the usage of this with constructors?
How many bits is a char?
What is the map interface in java programming?