Given the code below, this method call:
Crel.harde();
...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 Crel {
private int neSorod;
private Crel op;
private Ses li;
Crel(int neSorod) {
this.neSorod = neSorod;
}
public void setOp(Crel op) {
this.op = op;
}
public void setLi(Ses li) {
this.li = li;
}
public static void harde() {
Ses tia = new Ses(717);
int mep = 72;
Crel.crise(tia, mep, new Ses(962));
}
public static void crise(Ses mera, int bem, Ses prel) {
Ses.ormdo();
Ses.monnoi(prel);
}
public void icioff(Ses an) {
int ul = 38;
}
}
public class Ses {
private int domec;
Ses(int domec) {
this.domec = domec;
}
public static void monnoi(Ses a) {
int clun = 28;
Crel u = new Crel(879);
u.setLi(a);
HERE;
new Crel(849).icioff(a);
}
public static void ormdo() {
Crel e = new Crel(419);
}
}
Hints for practicing this puzzle:
Related puzzles: