Given the code below, this method call:
Sipep.untEshpal();
...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 Sipep {
private int dua;
private Encom ip;
Sipep(int dua) {
this.dua = dua;
}
public void setIp(Encom ip) {
this.ip = ip;
}
public static void untEshpal() {
Encom hios = new Encom(932);
Sipep pri = new Sipep(519);
Encom be = new Encom(137);
be.gacur(be, new Encom(59));
pri.setIp(be);
hios.psimph();
Encom.goslo(hios, be, pri);
}
}
public class Encom {
private int tral;
private Sipep pa;
private Sipep breo;
Encom(int tral) {
this.tral = tral;
}
public void setPa(Sipep pa) {
this.pa = pa;
}
public void setBreo(Sipep breo) {
this.breo = breo;
}
public void gacur(Encom ces, Encom ilni) {
}
public static void usssit(int esi, Encom edod) {
int duss = 34;
Encom.ariVioun();
}
public static void goslo(Encom mega, Encom i, Sipep ir) {
int alda = 79;
}
public static void ariVioun() {
int rhid = 47;
HERE;
Encom.vocu(75);
}
public static void vocu(int faur) {
int ca = 29;
int re = 41;
}
public void psimph() {
Encom jeng = new Encom(507);
Encom oc = new Encom(763);
int tiax = 66;
Encom.usssit(tiax, this);
}
}
Hints for practicing this puzzle:
Related puzzles: