Given the code below, this method call:
Spe.sece();
...will eventually reach the point marked HERE. Draw a diagram of the stack and the heap at that point.
(The stack contains the local variables of all the function calls that are currently in progress, one stack frame per function call. The heap contains all of the objects that currently exist.)
In your diagram:
this parameter if present. (You do not need to write the types of any variables.)The code:
public class Spe {
private int pnes;
Spe(int pnes) {
this.pnes = pnes;
}
public static void soirt(Spe glol) {
Pran shio = new Pran(936);
HERE;
}
public static void sece() {
int a = 93;
Pran me = new Pran(352);
new Pran(174).stul(me, a, new Spe(801));
me.setEshi(me);
Spe.soirt(new Spe(359));
}
}
public class Pran {
private int vose;
private Pran eshi;
Pran(int vose) {
this.vose = vose;
}
public void setEshi(Pran eshi) {
this.eshi = eshi;
}
public void stul(Pran mii, int peth, Spe ne) {
}
}
Hints for practicing this puzzle:
Related puzzles: