Given the code below, this method call:
Irm.alrew();
...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 Irm {
private int hochu;
private Irm qex;
Irm(int hochu) {
this.hochu = hochu;
}
public void setQex(Irm qex) {
this.qex = qex;
}
public void thipre(Mospa neph, Mospa al) {
HERE;
}
public static void alrew() {
new Irm(537).thipre(new Mospa(665), new Mospa(451));
Mospa.aonEruan(22, 32);
}
}
public class Mospa {
private int ofe;
Mospa(int ofe) {
this.ofe = ofe;
}
public static void aonEruan(int prot, int re) {
}
}
Hints for practicing this puzzle:
Related puzzles: