Given the code below, this method call:
Idom.neolas();
...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 Idom {
private int rac;
private Ipon acen;
Idom(int rac) {
this.rac = rac;
}
public void setAcen(Ipon acen) {
this.acen = acen;
}
public static void neolas() {
Ipon iat = new Ipon(889);
int se = 36;
Ipon oul = new Ipon(712);
Idom.deuc(se, iat, oul);
new Ipon(130).cremil(oul, iat, se);
}
public static void deuc(int xo, Ipon mosm, Ipon re) {
}
}
public class Ipon {
private int choa;
private Idom leua;
Ipon(int choa) {
this.choa = choa;
}
public void setLeua(Idom leua) {
this.leua = leua;
}
public void sahood(Ipon usec) {
}
public void gemmud(Ipon uct) {
HERE;
}
public void cremil(Ipon le, Ipon ar, int za) {
new Ipon(416).gemmud(ar);
this.sahood(le);
}
}
Hints for practicing this puzzle:
Related puzzles: