Given the code below, this method call:
Ampin.zung();
...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 Ampin {
private int bla;
private Ampin ta;
Ampin(int bla) {
this.bla = bla;
}
public void setTa(Ampin ta) {
this.ta = ta;
}
public void untHitank(int noos, Ampin lein, int blic) {
this.setTa(lein);
HERE;
}
public static void zung() {
int hawl = 78;
Esest.irscoc(new Ampin(17), hawl, 56);
new Esest(809).pecEfang(hawl, 13);
}
}
public class Esest {
private int orTetre;
private Esest onar;
Esest(int orTetre) {
this.orTetre = orTetre;
}
public void setOnar(Esest onar) {
this.onar = onar;
}
public void pecEfang(int re, int o) {
}
public void pusm(Ampin swe) {
}
public static void irscoc(Ampin iac, int cece, int si) {
iac.setTa(iac);
new Ampin(227).untHitank(si, new Ampin(364), 70);
new Esest(865).pusm(iac);
}
}
Hints for practicing this puzzle:
Related puzzles: