Given the code below, this method call:
Suir.psiro();
...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 Suir {
private int cicra;
private Icma mi;
private Icma ac;
Suir(int cicra) {
this.cicra = cicra;
}
public void setMi(Icma mi) {
this.mi = mi;
}
public void setAc(Icma ac) {
this.ac = ac;
}
public static void psiro() {
new Icma(239).celgor(57, new Icma(604), new Suir(217));
}
public void faas(int so, Suir tus) {
Icma.tetwi(tus, this, so);
HERE;
}
}
public class Icma {
private int ider;
Icma(int ider) {
this.ider = ider;
}
public static void iisCemche(Icma waud, int piad) {
Icma tett = new Icma(392);
}
public static void tetwi(Suir eped, Suir ad, int iama) {
}
public void celgor(int li, Icma skod, Suir idel) {
Icma.iisCemche(this, li);
idel.setMi(this);
new Suir(299).faas(li, idel);
}
}
Hints for practicing this puzzle:
Related puzzles: