Given the code below, this method call:
Plas.aneis();
...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 Plas {
private int ciNe;
Plas(int ciNe) {
this.ciNe = ciNe;
}
public static void aneis() {
int indi = 16;
new Cemad(685).ieres(new Plas(144), indi);
Plas.blePintte(indi, new Cemad(727), new Plas(344));
}
public static void blePintte(int ar, Cemad o, Plas op) {
o.setTre(op);
HERE;
}
}
public class Cemad {
private int rapan;
private Plas tre;
Cemad(int rapan) {
this.rapan = rapan;
}
public void setTre(Plas tre) {
this.tre = tre;
}
public void ieres(Plas gi, int se) {
}
}
Hints for practicing this puzzle:
Related puzzles: