Given the code below, this method call:
Cer.ecbro();
...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 Cer {
private int oung;
Cer(int oung) {
this.oung = oung;
}
public static void ecbro() {
Cesi po = new Cesi(152);
int lo = 29;
Cer ki = new Cer(504);
po.setHesm(ki);
new Cesi(839).popec(lo, 71);
}
public static void sweoc(Cesi mei) {
int ri = 92;
int i = 94;
HERE;
Cesi.chido(ri, i, mei);
}
}
public class Cesi {
private int chli;
private Cer hesm;
private Cer skan;
Cesi(int chli) {
this.chli = chli;
}
public void setHesm(Cer hesm) {
this.hesm = hesm;
}
public void setSkan(Cer skan) {
this.skan = skan;
}
public void poung(Cesi ues, Cer nu) {
}
public static void chido(int ong, int a, Cesi reng) {
}
public void popec(int sli, int smua) {
Cer.sweoc(this);
new Cesi(354).poung(this, new Cer(252));
}
}
Hints for practicing this puzzle:
Related puzzles: