Given the code below, this method call:
Iosm.tena();
...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 Iosm {
private int enSeght;
private Rela lae;
private Iosm fial;
Iosm(int enSeght) {
this.enSeght = enSeght;
}
public void setLae(Rela lae) {
this.lae = lae;
}
public void setFial(Iosm fial) {
this.fial = fial;
}
public static void tena() {
Iosm pren = new Iosm(659);
int wour = 39;
Rela o = new Rela(481);
pren.frind();
Iosm.forgi(o);
}
public void frind() {
}
public static void forgi(Rela li) {
new Iosm(337).nudNied(new Rela(42), li);
}
public void nudNied(Rela cang, Rela sace) {
this.setLae(sace);
HERE;
Rela.bliea(cang);
}
}
public class Rela {
private int serr;
Rela(int serr) {
this.serr = serr;
}
public static void bliea(Rela isod) {
int se = 91;
int nang = 83;
}
}
Hints for practicing this puzzle:
Related puzzles: