How does memory allocate when we create a object of a class?
Answers
Answered by
0
When we allocate the object using new(),the object is allocated on Heap, otherwise on Stack if not global or static. In java, when we only declare a variable of a couple class type, only a reference is created (memory is not allocated for the object). To allocate memory to an object,we must use new ().
Similar questions