Given the code below, this method call:
Onu.shess();
...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 Onu {
private int maPe;
Onu(int maPe) {
this.maPe = maPe;
}
public void molwi(int i) {
}
public static void shess() {
new Moust(995).muiIoc(new Onu(36), new Moust(280));
}
}
public class Moust {
private int paGe;
private Moust or;
Moust(int paGe) {
this.paGe = paGe;
}
public void setOr(Moust or) {
this.or = or;
}
public void muiIoc(Onu sa, Moust a) {
this.setOr(a);
HERE;
sa.molwi(58);
}
}
Hints for practicing this puzzle:
Related puzzles: