Given the code below, this method call:
Preio.eock();
...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 Preio {
private int saPust;
private Preio miom;
Preio(int saPust) {
this.saPust = saPust;
}
public void setMiom(Preio miom) {
this.miom = miom;
}
public void pidfe(Preio poph, Preio ool) {
HERE;
}
public static void eock() {
Preio ond = new Preio(952);
ond.setMiom(ond);
ond.pidfe(new Preio(64), ond);
new Bapra(413).ceser(new Bapra(788), ond, ond);
}
}
public class Bapra {
private int ecped;
Bapra(int ecped) {
this.ecped = ecped;
}
public void ceser(Bapra bi, Preio i, Preio om) {
}
}
Hints for practicing this puzzle:
Related puzzles: