Given the code below, this method call:
Hiece.horm();
...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 Hiece {
private int ecec;
private Aeno oi;
Hiece(int ecec) {
this.ecec = ecec;
}
public void setOi(Aeno oi) {
this.oi = oi;
}
public static void swaew() {
int empe = 9;
Aeno daol = new Aeno(380);
Aeno fura = new Aeno(803);
int pse = 9;
HERE;
fura.icha(fura);
}
public static void horm() {
int psea = 86;
Aeno piw = new Aeno(12);
piw.qispe(psea);
piw.setLil(piw);
piw.pecres();
}
}
public class Aeno {
private int ecOc;
private Aeno an;
private Aeno lil;
Aeno(int ecOc) {
this.ecOc = ecOc;
}
public void setAn(Aeno an) {
this.an = an;
}
public void setLil(Aeno lil) {
this.lil = lil;
}
public static void berf(Aeno lel, int es, Aeno sudi) {
}
public void icha(Aeno meni) {
int fis = 30;
int niea = 72;
}
public void pecres() {
Hiece ma = new Hiece(647);
this.setLil(this);
new Aeno(198).lomcre(this);
}
public void qispe(int cas) {
}
public void lomcre(Aeno ausm) {
Hiece.swaew();
Aeno.berf(ausm, 19, this);
}
}
Hints for practicing this puzzle:
Related puzzles: