Given the code below, this method call:
Itree.phur();
...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 Itree {
private int eaIs;
private Itree er;
Itree(int eaIs) {
this.eaIs = eaIs;
}
public void setEr(Itree er) {
this.er = er;
}
public static void phur() {
int quil = 93;
new Ficwi(417).voda(quil);
new Itree(280).sielth(new Itree(679), quil);
}
public void sielth(Itree ason, int esm) {
this.setEr(ason);
new Ficwi(313).lusm(new Ficwi(117));
}
}
public class Ficwi {
private int emPagn;
private Ficwi aun;
Ficwi(int emPagn) {
this.emPagn = emPagn;
}
public void setAun(Ficwi aun) {
this.aun = aun;
}
public void voda(int prul) {
Ficwi e = new Ficwi(443);
}
public void tethfa(Ficwi prud) {
int ilen = 85;
}
public void lusm(Ficwi od) {
od.tethfa(od);
od.setAun(this);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: