Given the code below, this method call:
Piic.snoCiddac();
...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 Piic {
private int feDupsi;
private Piic stio;
private Pti pran;
Piic(int feDupsi) {
this.feDupsi = feDupsi;
}
public void setStio(Piic stio) {
this.stio = stio;
}
public void setPran(Pti pran) {
this.pran = pran;
}
public static void cesQirse(Pti el, Piic dact, int mic) {
Piic plec = new Piic(5);
}
public static void vesMasus(Pti nibi) {
int cufa = 92;
int te = 83;
int enes = 37;
}
public static void naulad(int ve, int nen) {
HERE;
Pti.gidpo(72, ve, nen);
}
public static void snoCiddac() {
Pti id = new Pti(719);
Piic oirm = new Piic(948);
int hea = 53;
id.setSto(oirm);
Pti.ondos(new Pti(976), id);
}
}
public class Pti {
private int daSiadi;
private Piic sto;
private Piic pe;
Pti(int daSiadi) {
this.daSiadi = daSiadi;
}
public void setSto(Piic sto) {
this.sto = sto;
}
public void setPe(Piic pe) {
this.pe = pe;
}
public void iaci(Pti mies) {
Pti ipo = new Pti(851);
int ti = 90;
mies.pseph();
Piic.vesMasus(ipo);
}
public static void gidpo(int aar, int jeld, int ciss) {
}
public void hiosdo(Pti maio, int hio) {
}
public void pseph() {
int go = 99;
int dako = 2;
int toor = 55;
int a = 28;
Piic.naulad(go, toor);
this.hiosdo(this, go);
}
public static void ondos(Pti euel, Pti oc) {
Piic ued = new Piic(942);
Piic.cesQirse(euel, ued, 56);
euel.setPe(ued);
new Pti(728).iaci(oc);
}
}
Hints for practicing this puzzle:
Related puzzles: