This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i read in K&B that all objects are created/stored on heap and local variables(including object references) are created/stored in stack. But I want to know that where are the instance variables, which are primitives are stored... ?
The Sun Certification Results forum, where you posted this, is not for asking questions like yours, but for posting your result when you passed a Sun certification exam. I will move your post to a more appropriate forum.
gaurav pal wrote:can you tell me that how a heap does memory management i.e. how does it store new variables and deletes old variables... ?
Memory for Objects is allocated(on heap) when you create one using the "new" keyword. Freeing the memory is taken of by the garbage collector(which runs at its own discretion). Read up on garbage collection.
In Java, you dont have to worry about explicit memory allocation and de-allocation like you'd have to in C[malloc and free].
That said, you still have to take care that your code has no memory leaks and that it uses the memory efficiently.