Given the code below, this method call:
Hio.treLoght();
...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 Hio {
private int ven;
private Hio stie;
private Olnun si;
Hio(int ven) {
this.ven = ven;
}
public void setStie(Hio stie) {
this.stie = stie;
}
public void setSi(Olnun si) {
this.si = si;
}
public void pipent() {
int chus = 78;
int tedu = 79;
int cer = 46;
this.fosme(tedu, this);
Hio.stines(chus, this, cer);
}
public static void treLoght() {
Olnun to = new Olnun(953);
Hio cila = new Hio(67);
int lo = 27;
int oin = 70;
cila.setSi(to);
new Hio(88).pipent();
to.jaeMube(lo, 59, oin);
}
public void fosme(int ed, Hio uass) {
Olnun laa = new Olnun(567);
this.setSi(laa);
new Olnun(818).entCioun();
Olnun.melse(this, uass);
}
public static void stines(int unhe, Hio whes, int lon) {
int caep = 45;
}
}
public class Olnun {
private int eqa;
private Olnun mi;
Olnun(int eqa) {
this.eqa = eqa;
}
public void setMi(Olnun mi) {
this.mi = mi;
}
public void jaeMube(int qe, int qom, int ehul) {
}
public void entCioun() {
int sqen = 69;
int riph = 82;
HERE;
}
public static void melse(Hio hias, Hio enno) {
int ca = 38;
}
}
Hints for practicing this puzzle:
Related puzzles: