Given the code below, this method call:
Cime.spon();
...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 Cime {
private int reth;
Cime(int reth) {
this.reth = reth;
}
public void pelsud(int si, Eqi ner, Cime stal) {
this.pufGorcud(this, si);
HERE;
}
public void pufGorcud(Cime jel, int elni) {
}
public static void spon() {
Cime reum = new Cime(979);
new Cime(406).pelsud(83, new Eqi(974), reum);
}
}
public class Eqi {
private int ashi;
private Eqi irm;
Eqi(int ashi) {
this.ashi = ashi;
}
public void setIrm(Eqi irm) {
this.irm = irm;
}
}
Hints for practicing this puzzle:
Related puzzles: