Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What does this mean java?

1095


Explain an algorithm to find depth of a binary tree.

1032


What are the two ways of implementing multi-threading in java?

1489


Can string be considered as a keyword?

1028


What are static methods?

1039


How can constructor chaining be done by using the super keyword?

1087


What about instanceof operator in java?

1006


Will the compiler creates a default constructor if I have a parameterized constructor in the class?

1097


How to make a read-only class in java?

1147


What is externalizable interface?

1092


What are drawbacks of singleton class?

950


What is the difference between static (class) method and instance method?

1074


Is main is a keyword?

994


What does sizeof return?

978


What is java oops?

1058