Given the code below, this method call:
Emo.vutTwad();
...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 Emo {
private int tiDack;
private Phoc es;
private Emo te;
Emo(int tiDack) {
this.tiDack = tiDack;
}
public void setEs(Phoc es) {
this.es = es;
}
public void setTe(Emo te) {
this.te = te;
}
public void weash(int clen, Emo tios, int imb) {
}
public static void vutTwad() {
Emo ed = new Emo(872);
Emo tu = new Emo(583);
int sa = 69;
int ept = 48;
ed.weash(ept, new Emo(855), sa);
tu.setTe(ed);
Phoc.doci(tu, ed);
}
public static void eecTedip(Emo ahes) {
Phoc ghur = new Phoc(849);
int di = 96;
new Phoc(606).milcas(ghur);
}
}
public class Phoc {
private int nises;
private Emo ar;
Phoc(int nises) {
this.nises = nises;
}
public void setAr(Emo ar) {
this.ar = ar;
}
public static void pecee(int poad, Emo ro) {
Phoc ra = new Phoc(618);
Phoc keon = new Phoc(274);
}
public void preee(Phoc co, Phoc ohe, Phoc ix) {
}
public void milcas(Phoc ne) {
HERE;
ne.preee(ne, this, ne);
}
public static void doci(Emo toid, Emo rirs) {
int sern = 5;
Phoc.pecee(sern, rirs);
rirs.setTe(toid);
Emo.eecTedip(new Emo(940));
}
}
Hints for practicing this puzzle:
Related puzzles: