Given the code below, this method call:
Thalo.drapop();
...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 Thalo {
private int almi;
private Enan cer;
Thalo(int almi) {
this.almi = almi;
}
public void setCer(Enan cer) {
this.cer = cer;
}
public static void drapop() {
int biss = 74;
Thalo cem = new Thalo(238);
Enan ohid = new Enan(408);
cem.setCer(ohid);
Enan.prer(new Enan(416));
}
}
public class Enan {
private int ruc;
private Enan qer;
Enan(int ruc) {
this.ruc = ruc;
}
public void setQer(Enan qer) {
this.qer = qer;
}
public void prel() {
int adec = 86;
}
public static void prer(Enan sana) {
Enan a = new Enan(204);
int go = 82;
sana.setQer(a);
Enan.oooVaos(sana, 5, go);
Enan.gusm(a);
}
public static void oooVaos(Enan peor, int zang, int oom) {
peor.prel();
HERE;
}
public static void gusm(Enan ti) {
int ia = 52;
}
}
Hints for practicing this puzzle:
Related puzzles: