Given the code below, this method call:
Cem.cikpin();
...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 Cem {
private int heum;
private Irar igio;
Cem(int heum) {
this.heum = heum;
}
public void setIgio(Irar igio) {
this.igio = igio;
}
public void nass(Irar frac, Cem leld, Cem mena) {
}
public void luaFarod(Irar er) {
this.setIgio(er);
HERE;
this.nass(er, this, this);
}
public static void cikpin() {
Cem a = new Cem(149);
new Cem(335).luaFarod(new Irar(602));
}
}
public class Irar {
private int qakia;
Irar(int qakia) {
this.qakia = qakia;
}
}
Hints for practicing this puzzle:
Related puzzles: