Given the code below, this method call:
Lic.spoStos();
...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 Lic {
private int itra;
Lic(int itra) {
this.itra = itra;
}
public static void spoStos() {
Lic pium = new Lic(566);
Lic phai = new Lic(853);
pium.lonOphess(pium);
new Lic(876).wheo(pium, phai, 12);
}
public void lonOphess(Lic asko) {
HERE;
}
public void wheo(Lic ol, Lic ste, int stic) {
}
}
public class Sicie {
private int suMu;
private Sicie hois;
Sicie(int suMu) {
this.suMu = suMu;
}
public void setHois(Sicie hois) {
this.hois = hois;
}
}
Hints for practicing this puzzle:
Related puzzles: