Given the code below, this method call:
Phei.fier();
...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 Phei {
private int flent;
Phei(int flent) {
this.flent = flent;
}
public static void enttel(Phei zi, Phei fli) {
int maod = 95;
Phei.althci(maod, fli);
HERE;
}
public static void althci(int stuc, Phei er) {
int si = 34;
}
public void sewmer(Phei dano, int alu, Oossa ple) {
new Oossa(76).tiolho(alu, dano, this);
ple.setEs(ple);
Oossa.rhiPana(this);
Oossa.dechad(dano, ple, this);
}
public static void fier() {
int mi = 26;
Phei ston = new Phei(914);
Phei nal = new Phei(58);
new Phei(590).sewmer(ston, mi, new Oossa(578));
}
}
public class Oossa {
private int cil;
private Oossa ve;
private Oossa ge;
private Oossa es;
Oossa(int cil) {
this.cil = cil;
}
public void setVe(Oossa ve) {
this.ve = ve;
}
public void setGe(Oossa ge) {
this.ge = ge;
}
public void setEs(Oossa es) {
this.es = es;
}
public static void dechad(Phei im, Oossa aw, Phei le) {
}
public void tiolho(int jish, Phei rir, Phei wici) {
}
public static void rhiPana(Phei napo) {
Phei.enttel(new Phei(829), napo);
}
}
Hints for practicing this puzzle:
Related puzzles: