Given the code below, this method call:
Heeng.appras();
...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 Heeng {
private int cii;
Heeng(int cii) {
this.cii = cii;
}
public static void appras() {
int kno = 47;
new Heeng(200).dissa(new Knod(446));
new Heeng(616).berce(new Knod(364), kno, new Heeng(616));
}
public void berce(Knod ae, int simi, Heeng rir) {
}
public void dissa(Knod on) {
on.setEt(on);
HERE;
}
}
public class Knod {
private int enict;
private Knod et;
Knod(int enict) {
this.enict = enict;
}
public void setEt(Knod et) {
this.et = et;
}
}
Hints for practicing this puzzle:
Related puzzles: