Anonymous

How Memory Is Allocated In Java When Object Is Created?

1

1 Answers

Anonymous Profile
Anonymous answered
The java virtual machine uses two kinds of memory , the stack(for method variable ) and heap (for objects)  each time an object is created its done in heap ..which the garbage collector free.
..upon each function calls function variables are held in stack which is destroyed when function returns..if you dig deeper then there is static variable and classes which is held in neither stack or queue ..

Answer Question

Anonymous