Given the code below, this method call:
Ega.bastu();
...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 Ega {
private int eqeng;
private Ega ed;
Ega(int eqeng) {
this.eqeng = eqeng;
}
public void setEd(Ega ed) {
this.ed = ed;
}
public static void bastu() {
Ega.ische(new Ega(891), new Cias(198), new Ega(57));
}
public static void ische(Ega fel, Cias rost, Ega ciou) {
Cias.mabrur(ciou);
ciou.setEd(fel);
HERE;
}
}
public class Cias {
private int rhuc;
Cias(int rhuc) {
this.rhuc = rhuc;
}
public static void mabrur(Ega ciai) {
int o = 16;
}
}
Hints for practicing this puzzle:
Related puzzles: