Given the code below, this method call:
Pio.aitru();
...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 Pio {
private int ednoi;
private Bont ird;
private Pio na;
Pio(int ednoi) {
this.ednoi = ednoi;
}
public void setIrd(Bont ird) {
this.ird = ird;
}
public void setNa(Pio na) {
this.na = na;
}
public static void prass(Pio arec) {
int doun = 58;
Bont te = new Bont(589);
int plil = 25;
Pio.poson(doun, new Pio(426), te);
arec.setIrd(te);
arec.olom();
}
public static void aitru() {
int trer = 34;
Pio ta = new Pio(121);
Pio.prass(ta);
Bont.osoBucuom();
}
public static void pona() {
Bont pran = new Bont(816);
Bont i = new Bont(100);
Bont up = new Bont(100);
}
public static void poson(int eso, Pio idas, Bont ce) {
int ri = 49;
}
public void olom() {
Pio.pona();
new Bont(327).cias(new Pio(202));
}
}
public class Bont {
private int asae;
private Bont pren;
Bont(int asae) {
this.asae = asae;
}
public void setPren(Bont pren) {
this.pren = pren;
}
public void cias(Pio be) {
int mu = 87;
int ciar = 73;
this.setPren(this);
HERE;
}
public static void osoBucuom() {
int eck = 8;
}
}
Hints for practicing this puzzle:
Related puzzles: