Given the code below, this method call:
Pesm.bism();
...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 Pesm {
private int cosm;
private Pesm pha;
Pesm(int cosm) {
this.cosm = cosm;
}
public void setPha(Pesm pha) {
this.pha = pha;
}
public static void bism() {
Pesm ra = new Pesm(363);
ra.setPha(ra);
new Pesm(446).iwndul(new Pesm(491), 37);
Oen.psau(ra, ra);
}
public void iwndul(Pesm bao, int alpi) {
HERE;
}
}
public class Oen {
private int heTrism;
Oen(int heTrism) {
this.heTrism = heTrism;
}
public static void psau(Pesm me, Pesm om) {
}
}
Hints for practicing this puzzle:
Related puzzles: