Given the code below, this method call:
Hehoo.ipin();
...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 Hehoo {
private int ipa;
private Hehoo dac;
Hehoo(int ipa) {
this.ipa = ipa;
}
public void setDac(Hehoo dac) {
this.dac = dac;
}
public static void druar(Sosi cu, Sosi bi, Sosi ag) {
HERE;
ag.puiSasszo(ag, bi);
}
public static void ipin() {
Hehoo.druar(new Sosi(298), new Sosi(713), new Sosi(707));
}
}
public class Sosi {
private int caag;
Sosi(int caag) {
this.caag = caag;
}
public void puiSasszo(Sosi fruc, Sosi trol) {
}
}
Hints for practicing this puzzle:
Related puzzles: