Given the code below, this method call:
Cisa.chiwd();
...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 Cisa {
private int isen;
private Cisa spo;
Cisa(int isen) {
this.isen = isen;
}
public void setSpo(Cisa spo) {
this.spo = spo;
}
public void breSkar(Cisa ulda, int on) {
}
public void plion(Cisa sa, int ia, int fing) {
sa.setSpo(this);
HERE;
sa.breSkar(this, fing);
}
public static void chiwd() {
int ceng = 77;
new Cisa(473).plion(new Cisa(550), ceng, ceng);
}
}
public class Slono {
private int igPa;
Slono(int igPa) {
this.igPa = igPa;
}
}
Hints for practicing this puzzle:
Related puzzles: