Given the code below, this method call:
Pti.wrod();
...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 Pti {
private int presm;
Pti(int presm) {
this.presm = presm;
}
public void plel(int oi, Fale preu) {
new Fale(185).ospus(preu, this, 51);
preu.setAwo(this);
HERE;
}
public static void wrod() {
int hawi = 57;
new Pti(659).plel(17, new Fale(479));
}
}
public class Fale {
private int iaWhe;
private Pti awo;
Fale(int iaWhe) {
this.iaWhe = iaWhe;
}
public void setAwo(Pti awo) {
this.awo = awo;
}
public void ospus(Fale skes, Pti ooss, int wi) {
}
}
Hints for practicing this puzzle:
Related puzzles: