Given the code below, this method call:
Espas.fliMalce();
...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 Espas {
private int rura;
Espas(int rura) {
this.rura = rura;
}
public static void fliMalce() {
Crami od = new Crami(770);
Crami gir = new Crami(556);
new Crami(85).dioPhea(gir);
od.whePudne(od, gir);
}
}
public class Crami {
private int plest;
private Espas bau;
Crami(int plest) {
this.plest = plest;
}
public void setBau(Espas bau) {
this.bau = bau;
}
public void dioPhea(Crami mo) {
HERE;
}
public void whePudne(Crami ci, Crami pras) {
}
}
Hints for practicing this puzzle:
Related puzzles: