Given the code below, this method call:
Hodti.rastri();
...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 Hodti {
private int kac;
private Hodti apra;
private Hodti biu;
Hodti(int kac) {
this.kac = kac;
}
public void setApra(Hodti apra) {
this.apra = apra;
}
public void setBiu(Hodti biu) {
this.biu = biu;
}
public static void rastri() {
int e = 52;
int goc = 96;
Hodti te = new Hodti(723);
te.setApra(te);
Ilcir.pueUtiss(goc, new Ilcir(856), e);
}
public void ancin(int od) {
Hodti ja = new Hodti(115);
}
}
public class Ilcir {
private int edDoang;
Ilcir(int edDoang) {
this.edDoang = edDoang;
}
public void vasm(Ilcir teou) {
int ci = 30;
}
public static void pueUtiss(int heae, Ilcir cio, int cime) {
new Hodti(808).ancin(heae);
new Ilcir(346).ciad(new Hodti(712), cio, heae);
}
public void ciad(Hodti sto, Ilcir xi, int lia) {
this.vasm(xi);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: