Memory Management in Java | Heap vs Stack
In Java, a variable can either hold a primitive type or a reference of an object. This holds true for all cases. Primitive types are stored in stack and objects are stored in heap. To store objects, it needs to maintain their structure. We’ve always heard that a variable can be passed by value or …
Continue reading “Memory Management in Java | Heap vs Stack”