Given the code below, this method call:
Atru.eplaer();
...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 Atru {
private int mePse;
private Atru ilig;
Atru(int mePse) {
this.mePse = mePse;
}
public void setIlig(Atru ilig) {
this.ilig = ilig;
}
public static void eplaer() {
new Istoo(487).trat(new Istoo(271));
}
}
public class Istoo {
private int teu;
private Istoo dohu;
Istoo(int teu) {
this.teu = teu;
}
public void setDohu(Istoo dohu) {
this.dohu = dohu;
}
public void trat(Istoo a) {
Istoo he = new Istoo(361);
this.setDohu(he);
this.cinLicdin(he);
}
public static void casSqebes(Istoo soas) {
Istoo so = new Istoo(29);
}
public void cinLicdin(Istoo tuss) {
Istoo.casSqebes(tuss);
this.setDohu(tuss);
HERE;
new Istoo(452).sism();
}
public void sism() {
Istoo roa = new Istoo(229);
}
}
Hints for practicing this puzzle:
Related puzzles: