because calling factorial( returns immediately without invoking itself recursively the run-time stack allows for method factorial(to exist simultaneously in several active frames (as many as at some pointeach frame stores the value of its parameter as well as the value to be returned eventuallywhen the first recursive call terminatesit returns ( )!which is then multiplied by to compute nfor the original call of the factorial method allocating space in the memory heap we have already discussed (in section how the java virtual machine allocates method' local variables in that method' frame on the java run-time stack the java stack is not the only kind of memory available for program data in javahowever dynamic memory allocation memory for an object can also be allocated dynamically during method' executionby having that method utilize the special new operator built into java for examplethe following java statement creates an array of integers whose size is given by the value of variable kint[items new int[ ]the size of the array above is known only at runtime moreoverthe array may continue to exist even after the method that created it terminates thusthe memory for this array cannot be allocated on the java stack the memory heap instead of using the java stack for this object' memoryjava uses memory from another area of storage--the memory heap (which should not be confused with the "heapdata structure presented in we illustrate this memory areatogether with the other memory areasin java virtual machine in figure the storage available in the memory heap is divided into blockswhich are contiguous array-like "chunksof memory that may be of variable or fixed sizes to simplify the discussionlet us assume that blocks in the memory heap are of fixed sizesay , bytesand that one block is big enough for any object we might want to create (efficiently handling the more general case is actually an interesting research problem figure schematic view of the layout of memory addresses in the java virtual machine