Given the code below, this method call:
Denca.cewsi();
...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 Denca {
private int edLi;
Denca(int edLi) {
this.edLi = edLi;
}
public static void cewsi() {
Denca si = new Denca(782);
Noled nost = new Noled(134);
Noled whon = new Noled(524);
nost.setPha(si);
whon.dengve();
whon.mafo(si, new Denca(156));
}
public static void fosmge(int ocra, Denca em, Noled sko) {
int mi = 43;
}
public static void whed(Denca he) {
int ol = 11;
HERE;
}
}
public class Noled {
private int houc;
private Denca chel;
private Denca pha;
private Noled pede;
Noled(int houc) {
this.houc = houc;
}
public void setChel(Denca chel) {
this.chel = chel;
}
public void setPha(Denca pha) {
this.pha = pha;
}
public void setPede(Noled pede) {
this.pede = pede;
}
public void dengve() {
int lol = 57;
Denca.fosmge(lol, new Denca(124), this);
this.setPede(this);
Noled.etri(lol, this);
this.chor(this, lol, new Noled(398));
}
public void chor(Noled ud, int duio, Noled oan) {
}
public void mafo(Denca mion, Denca un) {
Denca ro = new Denca(597);
}
public static void etri(int a, Noled me) {
Denca.whed(new Denca(892));
}
}
Hints for practicing this puzzle:
Related puzzles: