Given the code below, this method call:
Aron.biras();
...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 Aron {
private int ime;
private Aron tak;
Aron(int ime) {
this.ime = ime;
}
public void setTak(Aron tak) {
this.tak = tak;
}
public static void biras() {
Aron ilbe = new Aron(905);
ilbe.setTak(ilbe);
ilbe.craste();
}
public void craste() {
Aron nao = new Aron(85);
HERE;
new Miber(61).megrad();
}
}
public class Miber {
private int nuPimce;
Miber(int nuPimce) {
this.nuPimce = nuPimce;
}
public void megrad() {
}
}
Hints for practicing this puzzle:
Related puzzles: