Given the code below, this method call:
Fehe.pelPludan();
...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 Fehe {
private int bussi;
private Deest esi;
private Deest ulre;
Fehe(int bussi) {
this.bussi = bussi;
}
public void setEsi(Deest esi) {
this.esi = esi;
}
public void setUlre(Deest ulre) {
this.ulre = ulre;
}
public void bruRidin(Fehe esia) {
int ceng = 11;
int phio = 15;
this.glin(ceng, phio, this);
HERE;
}
public void praSlin(Fehe icvi) {
this.bruRidin(this);
}
public void glin(int et, int lec, Fehe mi) {
}
public void tral() {
new Fehe(942).smir(this, new Fehe(300), new Deest(295));
new Fehe(288).praSlin(this);
}
public void smir(Fehe psa, Fehe vi, Deest rou) {
}
public static void pelPludan() {
Deest uste = new Deest(759);
Fehe anso = new Fehe(742);
Deest blir = new Deest(854);
Fehe sphe = new Fehe(625);
uste.setUl(anso);
anso.tral();
blir.acoVawe();
}
}
public class Deest {
private int ongat;
private Fehe ul;
Deest(int ongat) {
this.ongat = ongat;
}
public void setUl(Fehe ul) {
this.ul = ul;
}
public void acoVawe() {
int bue = 62;
int eio = 35;
int shar = 77;
}
}
Hints for practicing this puzzle:
Related puzzles: