Given the code below, this method call:
Husmo.cesCanson();
...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 Husmo {
private int esSicli;
private Viel os;
Husmo(int esSicli) {
this.esSicli = esSicli;
}
public void setOs(Viel os) {
this.os = os;
}
public static void mecIrmuss() {
Husmo e = new Husmo(139);
}
public static void cesCanson() {
Husmo.mecIrmuss();
new Viel(21).umsil(new Viel(708), new Husmo(197), new Husmo(468));
}
}
public class Viel {
private int irIl;
Viel(int irIl) {
this.irIl = irIl;
}
public void umsil(Viel no, Husmo lo, Husmo u) {
lo.setOs(no);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: