Given the code below, this method call:
Losai.nolha();
...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 Losai {
private int erUid;
private Esh endi;
private Esh ele;
private Esh thes;
Losai(int erUid) {
this.erUid = erUid;
}
public void setEndi(Esh endi) {
this.endi = endi;
}
public void setEle(Esh ele) {
this.ele = ele;
}
public void setThes(Esh thes) {
this.thes = thes;
}
public static void nolha() {
Esh plon = new Esh(514);
int civo = 15;
Esh spel = new Esh(627);
Esh dena = new Esh(87);
dena.kolou(civo, plon, dena);
Esh.iacop(dena);
}
public static void iaen(int hi, int tuc, Esh ar) {
}
public static void laad(int lior, Esh eund) {
int la = 94;
eund.losin(eund);
HERE;
}
}
public class Esh {
private int hos;
Esh(int hos) {
this.hos = hos;
}
public static void nuss(Esh a, Esh gri, int ther) {
int cla = 0;
Losai.laad(0, gri);
Losai.iaen(cla, ther, a);
}
public void kolou(int kisi, Esh su, Esh e) {
}
public void losin(Esh el) {
}
public static void iacop(Esh ome) {
int ang = 73;
Esh ac = new Esh(156);
Esh pi = new Esh(655);
Esh.nuss(pi, ome, ang);
}
}
Hints for practicing this puzzle:
Related puzzles: