Given the code below, this method call:
Omip.irru();
...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 Omip {
private int daSoonk;
private Alm cror;
private Alm ei;
Omip(int daSoonk) {
this.daSoonk = daSoonk;
}
public void setCror(Alm cror) {
this.cror = cror;
}
public void setEi(Alm ei) {
this.ei = ei;
}
public void nasm(int adac) {
int aod = 99;
int sqa = 43;
int po = 75;
}
public void donloa(Omip plis) {
int es = 5;
new Alm(708).groc(es, new Omip(959), plis);
new Omip(101).aunNoc(plis);
Alm.pered(this);
}
public static void irru() {
Alm sio = new Alm(142);
Omip frep = new Omip(65);
int woc = 8;
Alm om = new Alm(843);
om.setEcre(sio);
new Omip(310).donloa(frep);
}
public static void litep(int sa) {
Omip.mism(sa, sa, sa);
HERE;
}
public void nacZoust() {
int fea = 24;
int he = 84;
int sni = 16;
this.nasm(he);
Omip.litep(he);
}
public static void mism(int nibi, int crir, int si) {
int pao = 83;
}
public void aunNoc(Omip hil) {
Alm ril = new Alm(504);
ril.setPe(hil);
hil.nacZoust();
}
}
public class Alm {
private int meol;
private Omip pe;
private Alm ecre;
Alm(int meol) {
this.meol = meol;
}
public void setPe(Omip pe) {
this.pe = pe;
}
public void setEcre(Alm ecre) {
this.ecre = ecre;
}
public static void pered(Omip u) {
int os = 93;
int shar = 99;
int fo = 33;
int igec = 62;
}
public void groc(int pi, Omip riou, Omip nent) {
int qawi = 23;
}
}
Hints for practicing this puzzle:
Related puzzles: