Given the code below, this method call:
Olo.biar();
...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 Olo {
private int macel;
private Olo haun;
private Olo prel;
Olo(int macel) {
this.macel = macel;
}
public void setHaun(Olo haun) {
this.haun = haun;
}
public void setPrel(Olo prel) {
this.prel = prel;
}
public static void biar() {
Bagro.mosid(new Bagro(193));
Olo.endne(new Bagro(492), new Bagro(759), new Bagro(590));
}
public static void endne(Bagro cil, Bagro noss, Bagro oe) {
noss.oextre(oe);
}
public static void cletri(Bagro in) {
Bagro pa = new Bagro(762);
Olo osbe = new Olo(380);
int oee = 89;
}
}
public class Bagro {
private int coubi;
private Olo ot;
Bagro(int coubi) {
this.coubi = coubi;
}
public void setOt(Olo ot) {
this.ot = ot;
}
public void grar() {
Bagro le = new Bagro(496);
int muce = 22;
HERE;
}
public void oextre(Bagro oss) {
Bagro uina = new Bagro(205);
int thol = 84;
Olo.cletri(this);
oss.grar();
this.halar(this, uina, thol);
}
public static void mosid(Bagro ipre) {
int ou = 53;
Bagro em = new Bagro(811);
Olo ceri = new Olo(77);
}
public void halar(Bagro plai, Bagro lau, int so) {
}
}
Hints for practicing this puzzle:
Related puzzles: