File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the difference ? int / Interger" Watch "What is the difference ? int / Interger" New topic

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

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
Katrina Owen

Joined: Nov 03, 2006
Posts: 1367
I'd suggest taking a look at story about cups, which explains a lot of this really nicely.
I agree. Here's the link:
subject: What is the difference ? int / Interger
It's not a secret anymore!