Given the code below, this method call:
Noal.psuc();
...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 Noal {
private int xoe;
private Reebo emce;
private Reebo cil;
Noal(int xoe) {
this.xoe = xoe;
}
public void setEmce(Reebo emce) {
this.emce = emce;
}
public void setCil(Reebo cil) {
this.cil = cil;
}
public static void psuc() {
Noal siox = new Noal(166);
int ta = 84;
Noal.alch();
}
public static void upsed(Noal enal) {
int me = 53;
int da = 90;
Noal.pren();
HERE;
}
public static void pren() {
}
public static void alch() {
Reebo aeis = new Reebo(94);
Noal qa = new Noal(208);
Noal pse = new Noal(830);
qa.setCil(aeis);
Noal.upsed(qa);
aeis.gisk(pse);
}
}
public class Reebo {
private int niec;
Reebo(int niec) {
this.niec = niec;
}
public void gisk(Noal ruau) {
}
}
Hints for practicing this puzzle:
Related puzzles: