Given the code below, this method call:
Sti.rulfen();
...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 Sti {
private int orRess;
private Sti itoc;
Sti(int orRess) {
this.orRess = orRess;
}
public void setItoc(Sti itoc) {
this.itoc = itoc;
}
public void thriw(Sti hus) {
int ut = 37;
int da = 57;
}
public static void eafri() {
Sti la = new Sti(493);
int nen = 85;
la.setItoc(la);
new Tessi(282).uodTakorn(nen, new Sti(395));
Tessi.udan(nen);
}
public static void rulfen() {
int co = 69;
int obud = 4;
int tir = 78;
Sti.eafri();
}
}
public class Tessi {
private int pri;
private Sti jol;
private Tessi ec;
Tessi(int pri) {
this.pri = pri;
}
public void setJol(Sti jol) {
this.jol = jol;
}
public void setEc(Tessi ec) {
this.ec = ec;
}
public static void enchmo() {
int se = 28;
int trer = 63;
int cish = 37;
}
public static void udan(int re) {
int miho = 40;
}
public void uodTakorn(int ri, Sti duta) {
this.setEc(this);
new Tessi(457).whatde();
duta.thriw(duta);
}
public void whatde() {
int ias = 27;
Sti ho = new Sti(17);
HERE;
Tessi.enchmo();
}
}
Hints for practicing this puzzle:
Related puzzles: