This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by Vicken Karaoghlanian: Simply put...
[list] Primitive types (short, char, byte, int, long, float, double) are allocated in the Stack.
Object are allocated in the heap, while their references are allocated in the Stack.
[ January 27, 2005: Message edited by: Vicken Karaoghlanian ]
This is not entirely true. If the primitive types or object references are LOCAL variables, then they ARE allocated on the stack. However, if they are instance or class variables instead, they are allocated in the heap. (Of course, this was mentioned above, but I just wanted to reiterate.)