Given the code below, this method call:
Icass.osco();
...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 Icass {
private int naDe;
private Icass ni;
Icass(int naDe) {
this.naDe = naDe;
}
public void setNi(Icass ni) {
this.ni = ni;
}
public void chla() {
int qa = 82;
Icass ae = new Icass(694);
int le = 79;
HERE;
ae.raxban(this);
}
public static void strir(Phe om, Icass id, int miud) {
Phe ligi = new Phe(886);
om.setBa(ligi);
new Icass(570).chla();
}
public void pushpa(Icass tia, int eck) {
Icass ei = new Icass(649);
}
public static void zidProtra(int saxa) {
}
public void raxban(Icass ri) {
int aw = 1;
}
public static void osco() {
Phe.ramfa(11);
Icass.zidProtra(42);
}
}
public class Phe {
private int liwni;
private Phe to;
private Phe ba;
Phe(int liwni) {
this.liwni = liwni;
}
public void setTo(Phe to) {
this.to = to;
}
public void setBa(Phe ba) {
this.ba = ba;
}
public static void ramfa(int i) {
Icass e = new Icass(797);
e.pushpa(new Icass(688), i);
e.setNi(e);
Icass.strir(new Phe(650), e, i);
}
}
Hints for practicing this puzzle:
Related puzzles: