3 ms·
When Java was created, they wanted to get rid of that complexity, so primitives always go on the stack and objects always go on the heap.* This was inherited f
by stcredzero 8y ago
When Java was created, they wanted to get rid of that complexity, so primitives always go on the stack and objects always go on the heap.*
This was inherited from Smalltalk. Everything was an "object reference," with tag bits and all, but SmallInteger was optimized by using the low 16 bits of the object reference pointer to store the SmallInteger. So you can think of Smalltalk as having SmallInteger as a "primitive" type with pass by value.