Given the code below, this method call:
Ungo.wilpla();
...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 Ungo {
private int pras;
private Cec ong;
Ungo(int pras) {
this.pras = pras;
}
public void setOng(Cec ong) {
this.ong = ong;
}
public static void shahor(Cec i) {
Cec.trepe(new Cec(326), i);
Cec.gioil(new Cec(759));
Cec.dacuis(i, i, i);
}
public static void wilpla() {
Ungo phe = new Ungo(560);
Cec nel = new Cec(126);
nel.setIr(phe);
Ungo.shahor(nel);
}
public static void prijel() {
Cec ua = new Cec(947);
Cec ijal = new Cec(125);
int occi = 4;
int mi = 28;
HERE;
ijal.qonve();
}
}
public class Cec {
private int siNal;
private Ungo nioc;
private Ungo ir;
Cec(int siNal) {
this.siNal = siNal;
}
public void setNioc(Ungo nioc) {
this.nioc = nioc;
}
public void setIr(Ungo ir) {
this.ir = ir;
}
public static void gioil(Cec in) {
Ungo.prijel();
}
public static void dacuis(Cec er, Cec on, Cec en) {
}
public static void trepe(Cec il, Cec nin) {
}
public void qonve() {
}
}
Hints for practicing this puzzle:
Related puzzles: