Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference ? int / Interger

 
podonga poron
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference of declaring a variable "int" or declaring it "Integer" ?



an explanation will be VERY appreciated

thanks !
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest taking a look at story about cups, which explains a lot of this really nicely.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic