Given the code below, this method call:
Spiaa.spiEbel();
...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 Spiaa {
private int ois;
private Spiaa cle;
Spiaa(int ois) {
this.ois = ois;
}
public void setCle(Spiaa cle) {
this.cle = cle;
}
public static void spiEbel() {
new Ladbe(538).anir(new Spiaa(499), new Ladbe(460));
}
}
public class Ladbe {
private int oen;
Ladbe(int oen) {
this.oen = oen;
}
public static void eekna(Ladbe pi, Ladbe co) {
}
public void anir(Spiaa tiul, Ladbe ebio) {
Ladbe.eekna(this, ebio);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: