Given the code below, this method call:
Zedpi.fiuss();
...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 Zedpi {
private int enFui;
private Zedpi nece;
Zedpi(int enFui) {
this.enFui = enFui;
}
public void setNece(Zedpi nece) {
this.nece = nece;
}
public void elsor(Tiona me, Zedpi opi) {
}
public static void fiuss() {
int daie = 52;
Tiona pren = new Tiona(435);
Zedpi se = new Zedpi(402);
pren.setQemi(se);
new Tiona(397).neen(se, 48);
}
}
public class Tiona {
private int hoPleci;
private Zedpi qemi;
Tiona(int hoPleci) {
this.hoPleci = hoPleci;
}
public void setQemi(Zedpi qemi) {
this.qemi = qemi;
}
public void winche() {
HERE;
}
public void neen(Zedpi gri, int cin) {
gri.elsor(new Tiona(996), gri);
this.setQemi(gri);
new Tiona(738).winche();
Tiona.melbe(gri, this);
}
public static void melbe(Zedpi eu, Tiona qa) {
}
}
Hints for practicing this puzzle:
Related puzzles: