Given the code below, this method call:
Ubu.deunts();
...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 Ubu {
private int peGerun;
Ubu(int peGerun) {
this.peGerun = peGerun;
}
public static void deunts() {
int huaw = 12;
Ang.nimia(huaw);
}
public void duante() {
Ubu peb = new Ubu(324);
}
}
public class Ang {
private int giar;
private Ang cui;
private Ubu swon;
Ang(int giar) {
this.giar = giar;
}
public void setCui(Ang cui) {
this.cui = cui;
}
public void setSwon(Ubu swon) {
this.swon = swon;
}
public void elum(Ang ceou, Ubu trec, int erun) {
}
public static void nimia(int ves) {
Ubu pide = new Ubu(355);
pide.duante();
new Ang(184).spol(pide, ves, new Ang(983));
}
public void spol(Ubu a, int thod, Ang qeci) {
qeci.setSwon(a);
HERE;
new Ang(286).elum(new Ang(562), a, thod);
}
}
Hints for practicing this puzzle:
Related puzzles: