Given the code below, this method call:
Zin.smofec();
...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 Zin {
private int suil;
private Zin kiw;
private Iathe cus;
Zin(int suil) {
this.suil = suil;
}
public void setKiw(Zin kiw) {
this.kiw = kiw;
}
public void setCus(Iathe cus) {
this.cus = cus;
}
public void dacpel(int hil) {
}
public static void smofec() {
int eph = 61;
int vism = 81;
Iathe.natasm();
new Zin(684).dacpel(vism);
}
}
public class Iathe {
private int sner;
Iathe(int sner) {
this.sner = sner;
}
public static void rhosca(Zin ga, Iathe iet, Iathe cu) {
ga.setCus(cu);
HERE;
new Iathe(530).sciami();
}
public void sciami() {
Iathe ma = new Iathe(198);
Zin umas = new Zin(2);
}
public static void natasm() {
Iathe di = new Iathe(513);
Zin ebim = new Zin(890);
ebim.setKiw(ebim);
Iathe.rhosca(ebim, di, new Iathe(554));
}
}
Hints for practicing this puzzle:
Related puzzles: