Given the code below, this method call:
Uldo.gidap();
...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 Uldo {
private int chont;
private Sli joc;
Uldo(int chont) {
this.chont = chont;
}
public void setJoc(Sli joc) {
this.joc = joc;
}
public void deod(int sias, Uldo il) {
}
public void ardir() {
int sqac = 0;
this.deod(sqac, this);
HERE;
}
public static void gidap() {
Sli uc = new Sli(250);
Sli dawu = new Sli(99);
new Uldo(801).ardir();
}
}
public class Sli {
private int viKneil;
Sli(int viKneil) {
this.viKneil = viKneil;
}
}
Hints for practicing this puzzle:
Related puzzles: