Skip to content

Tag: stack-memory

Instance created inside of a Method

I have not been able to find any reliable literature on this but i’m curious as to where an object is stored if its created inside of a method ? on the stack or on the heap in java 8? I know that normally only local primitives, reference variables and function calls are stored on the stack and that obje…

where is array saved in memory in java?

If I have a function that in that function I declare: Where are arr and the whole array stored? heap? stack? Does it matter if the declaration is in some function or in main()? and let’s say I also have these command lines: where are arr[0] and arr[1] stored? Answer Memory diagram: Boxes are memory loca…

Java’s enum… Where are they created?

Since enum in C# are on the stack, I was wondering where enum, in Java, where created. On the stack? On the heap? In some mysterious other place? Enumeration in C# are more primitive than those in Java, this might explain why they are created on the stack… Where are they? I can’t find them! Thanks…

Java Object Method Stack Frame Parameters

So in java, say you have a non-static method ‘bar()’ in an class ‘Foo’. Say then that you call this method like so: Now the stack frame for the call includes the integer parameter, as well as a ‘this’ parameter to be used as an internal reference to the object. What other i…