Given the code below, this method call:
Goor.treMiust();
...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 Goor {
private int ork;
Goor(int ork) {
this.ork = ork;
}
public static void treMiust() {
new Sto(246).rabet();
new Sto(363).oond(new Sto(529));
}
}
public class Sto {
private int esIoce;
private Sto er;
Sto(int esIoce) {
this.esIoce = esIoce;
}
public void setEr(Sto er) {
this.er = er;
}
public void oond(Sto heqe) {
this.setEr(heqe);
HERE;
}
public void rabet() {
Goor nen = new Goor(542);
}
}
Hints for practicing this puzzle:
Related puzzles: