Given the code below, this method call:
Grur.icos();
...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 Grur {
private int emi;
private Peol is;
private Peol to;
private Grur gass;
Grur(int emi) {
this.emi = emi;
}
public void setIs(Peol is) {
this.is = is;
}
public void setTo(Peol to) {
this.to = to;
}
public void setGass(Grur gass) {
this.gass = gass;
}
public void saaeg(Grur di, Grur i, Grur sebe) {
}
public static void cadar(Grur iass) {
Grur.cepid();
iass.paeIca();
}
public void paeIca() {
Grur asri = new Grur(159);
Grur thur = new Grur(122);
Peol le = new Peol(893);
Grur.prilem(thur);
asri.setTo(le);
thur.qopRiouss();
}
public static void prilem(Grur iarm) {
}
public static void cepid() {
int ho = 16;
Grur ga = new Grur(823);
int ge = 76;
}
public static void icos() {
Grur swis = new Grur(629);
swis.saaeg(new Grur(559), swis, new Grur(796));
Grur.cadar(swis);
}
public void qopRiouss() {
Peol me = new Peol(900);
int aill = 97;
int ro = 36;
this.setIs(me);
HERE;
}
}
public class Peol {
private int reu;
Peol(int reu) {
this.reu = reu;
}
}
Hints for practicing this puzzle:
Related puzzles: