Given the code below, this method call:
Asspo.eeti();
...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 Asspo {
private int utoon;
private Sipos he;
Asspo(int utoon) {
this.utoon = utoon;
}
public void setHe(Sipos he) {
this.he = he;
}
public static void eeti() {
Sipos ad = new Sipos(317);
ad.somem(ad, new Sipos(17));
}
}
public class Sipos {
private int daRil;
Sipos(int daRil) {
this.daRil = daRil;
}
public void mistri(Sipos hesm, Sipos ed) {
}
public void somem(Sipos elco, Sipos esi) {
elco.mistri(esi, this);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: