Given the code below, this method call:
Dula.houPoqesm();
...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 Dula {
private int prean;
Dula(int prean) {
this.prean = prean;
}
public void rerbra(Asm iod, Dula qict) {
}
public static void houPoqesm() {
new Asm(976).jerdu(new Asm(0), new Dula(853));
}
}
public class Asm {
private int deko;
private Asm gi;
Asm(int deko) {
this.deko = deko;
}
public void setGi(Asm gi) {
this.gi = gi;
}
public void jerdu(Asm amja, Dula ec) {
amja.setGi(this);
HERE;
ec.rerbra(amja, ec);
}
}
Hints for practicing this puzzle:
Related puzzles: