Given the code below, this method call:
Pepsa.sprond();
...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 Pepsa {
private int ous;
private Ces di;
private Ces em;
Pepsa(int ous) {
this.ous = ous;
}
public void setDi(Ces di) {
this.di = di;
}
public void setEm(Ces em) {
this.em = em;
}
public static void edso(Pepsa fu, Ces sqi) {
int ed = 55;
fu.gouac(ed);
sqi.setLo(fu);
new Pepsa(465).uicu(sqi);
sqi.bifas(sqi);
}
public void gouac(int riko) {
Pepsa i = new Pepsa(903);
}
public void uicu(Ces spe) {
spe.setLo(this);
Ces.wrasm(this);
}
public static void sprond() {
Ces.pesess(new Ces(265), new Pepsa(261), new Ces(719));
}
public void cuhesh(Ces taua, Ces zoc) {
Pepsa mo = new Pepsa(595);
}
}
public class Ces {
private int isBacde;
private Ces hi;
private Pepsa lo;
Ces(int isBacde) {
this.isBacde = isBacde;
}
public void setHi(Ces hi) {
this.hi = hi;
}
public void setLo(Pepsa lo) {
this.lo = lo;
}
public static void pesess(Ces cing, Pepsa si, Ces qeas) {
Pepsa se = new Pepsa(122);
se.cuhesh(new Ces(817), cing);
cing.setHi(qeas);
Pepsa.edso(si, new Ces(160));
}
public void bifas(Ces eze) {
int al = 59;
int ath = 52;
int ec = 79;
}
public static void crouf() {
int flia = 80;
}
public static void wrasm(Pepsa cu) {
int tusm = 48;
int wepo = 9;
int scis = 72;
int le = 33;
Ces.crouf();
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: