Given the code below, this method call:
Cec.biwoc();
...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 Cec {
private int seAscha;
private Cec co;
private Cec odbo;
Cec(int seAscha) {
this.seAscha = seAscha;
}
public void setCo(Cec co) {
this.co = co;
}
public void setOdbo(Cec odbo) {
this.odbo = odbo;
}
public void pnoden(Ocal ci, int gea) {
this.setOdbo(this);
new Cec(229).adco(this, gea);
}
public void jildo() {
Ocal flae = new Ocal(178);
int fri = 55;
int ouee = 77;
this.esmSeco(68, this);
HERE;
Ocal.stePrul(this, ouee, fri);
}
public void adco(Cec er, int eju) {
er.setOdbo(this);
new Cec(298).jildo();
}
public void esmSeco(int i, Cec de) {
int ki = 39;
}
public static void biwoc() {
Ocal.torm(new Cec(674), new Ocal(393));
new Cec(612).pnoden(new Ocal(385), 4);
}
}
public class Ocal {
private int mioc;
private Ocal kead;
Ocal(int mioc) {
this.mioc = mioc;
}
public void setKead(Ocal kead) {
this.kead = kead;
}
public static void stePrul(Cec udni, int mi, int ra) {
}
public static void torm(Cec en, Ocal a) {
}
}
Hints for practicing this puzzle:
Related puzzles: