Given the code below, this method call:
Cras.hiri();
...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 Cras {
private int emasm;
private Cras pri;
Cras(int emasm) {
this.emasm = emasm;
}
public void setPri(Cras pri) {
this.pri = pri;
}
public static void hiri() {
int dipi = 33;
Cras la = new Cras(346);
la.setPri(la);
new Eobe(157).eckRurk();
}
public static void rilRiza(Cras e) {
Cras ci = new Cras(754);
}
}
public class Eobe {
private int phour;
private Eobe tud;
Eobe(int phour) {
this.phour = phour;
}
public void setTud(Eobe tud) {
this.tud = tud;
}
public void tedas() {
}
public void eckRurk() {
int zas = 40;
Cras.rilRiza(new Cras(296));
this.setTud(this);
new Eobe(374).tracse(zas, this, new Cras(936));
this.tedas();
}
public void tracse(int ae, Eobe ieo, Cras ioim) {
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: