Given the code below, this method call:
Recra.glocas();
...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 Recra {
private int tihas;
private Recra casm;
private Dovuc whu;
Recra(int tihas) {
this.tihas = tihas;
}
public void setCasm(Recra casm) {
this.casm = casm;
}
public void setWhu(Dovuc whu) {
this.whu = whu;
}
public static void dibaif(Recra daol, Recra jia) {
Recra neme = new Recra(590);
}
public static void glocas() {
int es = 32;
int io = 53;
Dovuc hioc = new Dovuc(807);
hioc.felAziass(es);
}
public void purte() {
int apei = 5;
}
public void himem(Recra ri, Recra ha) {
Recra.dibaif(ha, ri);
HERE;
}
}
public class Dovuc {
private int xelin;
Dovuc(int xelin) {
this.xelin = xelin;
}
public void felAziass(int prer) {
Recra co = new Recra(714);
new Recra(639).purte();
co.setWhu(this);
co.himem(new Recra(404), co);
}
}
Hints for practicing this puzzle:
Related puzzles: