Given the code below, this method call:
Apro.aciSpe();
...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 Apro {
private int tisel;
private Apro vasm;
Apro(int tisel) {
this.tisel = tisel;
}
public void setVasm(Apro vasm) {
this.vasm = vasm;
}
public static void aciSpe() {
new Oteu(584).imrer(new Oteu(305), new Oteu(793), new Oteu(505));
}
}
public class Oteu {
private int gnul;
Oteu(int gnul) {
this.gnul = gnul;
}
public void scoLugh(Oteu acia) {
}
public void imrer(Oteu miwe, Oteu os, Oteu be) {
this.scoLugh(os);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: