Given the code below, this method call:
Iadu.efeng();
...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 Iadu {
private int thi;
Iadu(int thi) {
this.thi = thi;
}
public void sple(Pebra ne, Pebra lont) {
}
public static void efeng() {
Pebra oma = new Pebra(692);
oma.setBuio(oma);
new Pebra(578).uadiaw();
}
}
public class Pebra {
private int roOigo;
private Pebra buio;
Pebra(int roOigo) {
this.roOigo = roOigo;
}
public void setBuio(Pebra buio) {
this.buio = buio;
}
public void uadiaw() {
new Iadu(807).sple(new Pebra(9), this);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: