Given the code below, this method call:
Tasal.deler();
...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 Tasal {
private int hism;
private Harlu lom;
Tasal(int hism) {
this.hism = hism;
}
public void setLom(Harlu lom) {
this.lom = lom;
}
public static void deler() {
Tasal ja = new Tasal(341);
new Harlu(280).piorac();
new Tasal(137).ploro();
}
public void ploro() {
Tasal faw = new Tasal(166);
HERE;
}
}
public class Harlu {
private int trul;
Harlu(int trul) {
this.trul = trul;
}
public void piorac() {
Tasal ec = new Tasal(500);
}
}
Hints for practicing this puzzle:
Related puzzles: