Given the code below, this method call:
Spu.emoRul();
...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 Spu {
private int acu;
Spu(int acu) {
this.acu = acu;
}
public void mammo() {
Spu ca = new Spu(749);
int co = 72;
Hiar.handis();
HERE;
ca.pulben();
}
public static void emoRul() {
Spu.toesm(new Hiar(844), new Spu(955), new Hiar(679));
}
public void pulben() {
int crid = 76;
}
public static void toesm(Hiar fudo, Spu fo, Hiar os) {
os.setIt(fudo);
fo.mammo();
}
}
public class Hiar {
private int neont;
private Hiar flid;
private Hiar it;
Hiar(int neont) {
this.neont = neont;
}
public void setFlid(Hiar flid) {
this.flid = flid;
}
public void setIt(Hiar it) {
this.it = it;
}
public static void handis() {
int mi = 12;
}
}
Hints for practicing this puzzle:
Related puzzles: