Given the code below, this method call:
Mosda.prit();
...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 Mosda {
private int caNiu;
private Mosda thoa;
Mosda(int caNiu) {
this.caNiu = caNiu;
}
public void setThoa(Mosda thoa) {
this.thoa = thoa;
}
public static void prit() {
Dres cras = new Dres(125);
Dres en = new Dres(865);
Dres.bemeck(new Dres(822), en, cras);
en.oonDus(new Dres(865));
}
}
public class Dres {
private int skan;
Dres(int skan) {
this.skan = skan;
}
public static void bemeck(Dres scei, Dres ad, Dres a) {
}
public void oonDus(Dres lo) {
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: