Given the code below, this method call:
Nal.eliact();
...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 Nal {
private int onIsi;
Nal(int onIsi) {
this.onIsi = onIsi;
}
public static void eliact() {
new Hadus(168).daziod(new Nal(693));
Hadus.glaRene();
}
}
public class Hadus {
private int esh;
private Hadus hi;
Hadus(int esh) {
this.esh = esh;
}
public void setHi(Hadus hi) {
this.hi = hi;
}
public void daziod(Nal unt) {
}
public static void glaRene() {
Nal oe = new Nal(139);
Hadus ploa = new Hadus(757);
ploa.setHi(ploa);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: