aspose file tools*
The moose likes Beginning Java and the fly likes What is the difference ? int / Interger Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the difference ? int / Interger" Watch "What is the difference ? int / Interger" New topic
Author

What is the difference ? int / Interger

podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
what is the difference of declaring a variable "int" or declaring it "Integer" ?



an explanation will be VERY appreciated

thanks !
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

An int is a primitive type. An int variable stores the actual 32-bit value.

An Integer is a type of object that "wraps" an int value. An Integer variable stores a reference to the Integer instance.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1364
    
  17
I'd suggest taking a look at story about cups, which explains a lot of this really nicely.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is the difference ? int / Interger