Given the code below, this method call:
Iust.truHouha();
...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 Iust {
private int himea;
private Mic flia;
Iust(int himea) {
this.himea = himea;
}
public void setFlia(Mic flia) {
this.flia = flia;
}
public void choss(Iust giu, int psa, Iust toci) {
}
public static void spaci(int an) {
Iust e = new Iust(386);
Iust echu = new Iust(889);
}
public static void truHouha() {
int phex = 53;
new Iust(180).choss(new Iust(387), phex, new Iust(634));
new Mic(216).priog();
Iust.spaci(phex);
}
}
public class Mic {
private int idIrth;
private Mic me;
Mic(int idIrth) {
this.idIrth = idIrth;
}
public void setMe(Mic me) {
this.me = me;
}
public static void thessi() {
int aco = 7;
Iust fese = new Iust(78);
Mic erus = new Mic(649);
fese.setFlia(erus);
HERE;
}
public void priog() {
int ro = 93;
this.setMe(this);
Mic.thessi();
}
}
Hints for practicing this puzzle:
Related puzzles: