Given the code below, this method call:
Uer.peae();
...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 Uer {
private int iest;
private Uer el;
private Uer lemi;
private Souhi so;
Uer(int iest) {
this.iest = iest;
}
public void setEl(Uer el) {
this.el = el;
}
public void setLemi(Uer lemi) {
this.lemi = lemi;
}
public void setSo(Souhi so) {
this.so = so;
}
public void rouc() {
int pios = 88;
}
public static void lacik(Uer zo, int ior, int gass) {
}
public void coust(Uer rer, Souhi owni) {
owni.faos(this, rer);
Uer.cood(new Souhi(548), rer);
}
public static void peae() {
Uer ec = new Uer(216);
ec.rouc();
ec.coust(ec, new Souhi(67));
}
public static void cimSpiou() {
int epci = 3;
Uer.lacik(new Uer(17), epci, 42);
HERE;
}
public static void cood(Souhi dooc, Uer ious) {
Uer oe = new Uer(678);
oe.setSo(dooc);
Uer.cimSpiou();
}
}
public class Souhi {
private int enBui;
Souhi(int enBui) {
this.enBui = enBui;
}
public void faos(Uer ninu, Uer he) {
}
}
Hints for practicing this puzzle:
Related puzzles: