Given the code below, this method call:
Krai.iarErm();
...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 Krai {
private int anIr;
private Radak tolm;
Krai(int anIr) {
this.anIr = anIr;
}
public void setTolm(Radak tolm) {
this.tolm = tolm;
}
public static void onnas(int grom, int ojem) {
}
public void esda(Radak iss, Krai mo, Radak i) {
this.setTolm(iss);
HERE;
}
public static void iarErm() {
new Krai(44).esda(new Radak(24), new Krai(673), new Radak(140));
Krai.onnas(18, 96);
}
}
public class Radak {
private int flir;
Radak(int flir) {
this.flir = flir;
}
}
Hints for practicing this puzzle:
Related puzzles: