Given the code below, this method call:
Pso.elmen();
...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 Pso {
private int pel;
private Chaid se;
Pso(int pel) {
this.pel = pel;
}
public void setSe(Chaid se) {
this.se = se;
}
public static void elmen() {
Pso irge = new Pso(556);
irge.prooa(irge, new Pso(266));
}
public void sesCirung(Pso ac, Pso ur, Pso sti) {
}
public void prooa(Pso oha, Pso es) {
HERE;
this.sesCirung(new Pso(630), this, oha);
}
}
public class Chaid {
private int ceLesh;
Chaid(int ceLesh) {
this.ceLesh = ceLesh;
}
}
Hints for practicing this puzzle:
Related puzzles: