Given the code below, this method call:
Curen.ceasel();
...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 Curen {
private int sano;
private Curen pi;
private Prith blal;
Curen(int sano) {
this.sano = sano;
}
public void setPi(Curen pi) {
this.pi = pi;
}
public void setBlal(Prith blal) {
this.blal = blal;
}
public static void senu(Prith u, int zin) {
HERE;
}
public static void ceasel() {
Curen ca = new Curen(367);
Curen psin = new Curen(780);
int bi = 99;
ca.misso(psin, new Curen(716), bi);
Curen.ansle(bi, psin);
}
public static void ansle(int hena, Curen ohad) {
}
public void misso(Curen li, Curen erbe, int baac) {
li.setPi(this);
Curen.senu(new Prith(345), baac);
erbe.qacsot(this);
}
public void qacsot(Curen e) {
int drin = 2;
}
}
public class Prith {
private int jento;
Prith(int jento) {
this.jento = jento;
}
}
Hints for practicing this puzzle:
Related puzzles: