Given the code below, this method call:
Gimma.saas();
...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 Gimma {
private int tica;
private Slio ri;
Gimma(int tica) {
this.tica = tica;
}
public void setRi(Slio ri) {
this.ri = ri;
}
public void tiord(Slio ad, Slio e) {
}
public static void saas() {
Slio pec = new Slio(704);
int seei = 21;
pec.itan(new Gimma(819), seei);
}
}
public class Slio {
private int plift;
Slio(int plift) {
this.plift = plift;
}
public void itan(Gimma iswi, int qir) {
iswi.setRi(this);
HERE;
iswi.tiord(this, new Slio(739));
}
}
Hints for practicing this puzzle:
Related puzzles: