JVM Stack And Heaps

  • Stack:
    • Store the function calls
  • Heap:
    • Store variables, instances and so on for garbage collector to collect

Notes: Java makes space for all the primative types in Object but if 1 Object referring the other object (for example House has Room), Java only makes space for the reference.