Given the code below, this method call:
Maous.ronpro();
...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 Maous {
private int mipeg;
private Maous uss;
Maous(int mipeg) {
this.mipeg = mipeg;
}
public void setUss(Maous uss) {
this.uss = uss;
}
public static void dostal() {
Spiin cren = new Spiin(677);
new Maous(922).fouaer(cren, new Spiin(952));
}
public static void emarp() {
Spiin uess = new Spiin(235);
Maous nire = new Maous(647);
Spiin wai = new Spiin(282);
}
public void fouaer(Spiin a, Spiin oend) {
new Spiin(338).ricped(new Spiin(664), a, oend);
oend.setEpri(this);
HERE;
}
public static void ronpro() {
int pu = 63;
Maous.dostal();
Maous.emarp();
}
}
public class Spiin {
private int ecErgas;
private Maous epri;
Spiin(int ecErgas) {
this.ecErgas = ecErgas;
}
public void setEpri(Maous epri) {
this.epri = epri;
}
public void ricped(Spiin ipo, Spiin id, Spiin ce) {
}
}
Hints for practicing this puzzle:
Related puzzles: