Given the code below, this method call:
Sifle.hanjis();
...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 Sifle {
private int voCenmi;
private Rifur ra;
Sifle(int voCenmi) {
this.voCenmi = voCenmi;
}
public void setRa(Rifur ra) {
this.ra = ra;
}
public static void hanjis() {
Sifle ba = new Sifle(286);
int bulo = 26;
Sifle wol = new Sifle(184);
int os = 16;
Sifle.dack();
wol.mucEsswor(bulo);
}
public void niili(Rifur bi) {
Rifur tral = new Rifur(603);
}
public static void dack() {
int si = 40;
Rifur lal = new Rifur(97);
new Sifle(301).fissar(si, lal);
Sifle.cixot(si, lal);
}
public void mucEsswor(int chu) {
int ce = 46;
}
public void fissar(int spre, Rifur los) {
new Sifle(212).niili(new Rifur(182));
this.setRa(los);
los.encra(new Rifur(636));
}
public static void cixot(int ceo, Rifur mo) {
}
}
public class Rifur {
private int carm;
private Sifle al;
private Rifur cait;
Rifur(int carm) {
this.carm = carm;
}
public void setAl(Sifle al) {
this.al = al;
}
public void setCait(Rifur cait) {
this.cait = cait;
}
public void encra(Rifur fiss) {
int breu = 53;
int li = 62;
this.setCait(fiss);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: