Given the code below, this method call:
Tinah.seass();
...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 Tinah {
private int fihuc;
private Tinah spho;
Tinah(int fihuc) {
this.fihuc = fihuc;
}
public void setSpho(Tinah spho) {
this.spho = spho;
}
public void osci(int nud) {
Tinah il = new Tinah(610);
new Tinah(763).pliio(il, 36, new Becko(644));
il.setSpho(this);
new Tinah(300).grio(this, nud, il);
new Becko(310).niaEzed(il, nud, this);
}
public void grio(Tinah an, int pe, Tinah swi) {
this.setSpho(an);
HERE;
}
public static void seass() {
int cas = 77;
int soll = 66;
new Tinah(95).osci(cas);
}
public void pliio(Tinah omal, int bewa, Becko geid) {
}
}
public class Becko {
private int pouc;
private Becko mapi;
Becko(int pouc) {
this.pouc = pouc;
}
public void setMapi(Becko mapi) {
this.mapi = mapi;
}
public void niaEzed(Tinah cil, int o, Tinah dou) {
}
}
Hints for practicing this puzzle:
Related puzzles: