Thread: wrapper classes
View Single Post
  #4 (permalink)  
Old 12-11-2007, 04:28 AM
staykovmarin staykovmarin is offline
Senior Member
 
Join Date: Nov 2007
Location: Newport, WA
Posts: 141
staykovmarin is on a distinguished road
There is really no reason to use the Integer class for something as simple:
Code:
int x = 7, y = 4; int d = y+x;
The difference is where the information is stored (primitives are on the stack, while Class instances are put on the heap). Primitives are the ones that you can add subtract and so on. Classes (with the exception of String) do not have those options.

(sorry for beating the topic to death, it took me a long time to reply, so i didnt see the other two answers getting posted)

Last edited by staykovmarin : 12-11-2007 at 05:06 AM. Reason: sorry
Reply With Quote