Given the code below, this method call:
Phesh.floo();
...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 Phesh {
private int wiint;
private Phesh cua;
Phesh(int wiint) {
this.wiint = wiint;
}
public void setCua(Phesh cua) {
this.cua = cua;
}
public static void nerni(int cel, int uck) {
int ota = 76;
int lole = 2;
}
public static void fostri() {
HERE;
Almi.cesZid(41, 89);
}
public void plapi(Almi olka) {
Almi ondo = new Almi(900);
Almi olca = new Almi(324);
int anu = 32;
olca.setAci(olka);
olca.triong(80, anu, new Phesh(37));
}
public static void floo() {
Almi ci = new Almi(401);
int pem = 72;
ci.setPrea(ci);
new Phesh(670).plapi(new Almi(508));
}
}
public class Almi {
private int papro;
private Almi epre;
private Almi prea;
private Almi aci;
Almi(int papro) {
this.papro = papro;
}
public void setEpre(Almi epre) {
this.epre = epre;
}
public void setPrea(Almi prea) {
this.prea = prea;
}
public void setAci(Almi aci) {
this.aci = aci;
}
public void triong(int jil, int io, Phesh clen) {
int sost = 79;
Almi.isen(clen);
this.setEpre(this);
this.drocal();
Phesh.nerni(61, sost);
}
public void drocal() {
int viar = 79;
int scos = 78;
Phesh.fostri();
Almi.giaung(scos, this);
}
public static void giaung(int iora, Almi vus) {
int idel = 61;
int omoc = 85;
int de = 0;
}
public static void isen(Phesh desm) {
int ib = 6;
int derc = 89;
int ipel = 77;
}
public static void cesZid(int irar, int crod) {
int jebi = 29;
}
}
Hints for practicing this puzzle:
Related puzzles: