Given the code below, this method call:
Mic.bulus();
...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 Mic {
private int meBaiss;
Mic(int meBaiss) {
this.meBaiss = meBaiss;
}
public static void bulus() {
new Ior(329).snebo();
new Ior(804).oscaic(new Mic(262), new Ior(830));
}
}
public class Ior {
private int glo;
private Mic prud;
Ior(int glo) {
this.glo = glo;
}
public void setPrud(Mic prud) {
this.prud = prud;
}
public void oscaic(Mic wa, Ior scer) {
}
public void snebo() {
Mic in = new Mic(337);
this.setPrud(in);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: