Given the code below, this method call:
Tro.shemci();
...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 Tro {
private int isEnres;
Tro(int isEnres) {
this.isEnres = isEnres;
}
public static void shemci() {
Eston cren = new Eston(957);
Eston i = new Eston(67);
Tro.tuoulu(i, cren);
}
public static void tuoulu(Eston fa, Eston de) {
fa.iuid(new Eston(643));
HERE;
}
}
public class Eston {
private int lica;
private Tro ert;
Eston(int lica) {
this.lica = lica;
}
public void setErt(Tro ert) {
this.ert = ert;
}
public void iuid(Eston e) {
}
}
Hints for practicing this puzzle:
Related puzzles: