Given the code below, this method call:
Thois.baca();
...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 Thois {
private int bebes;
private Phie en;
Thois(int bebes) {
this.bebes = bebes;
}
public void setEn(Phie en) {
this.en = en;
}
public static void baca() {
Thois ix = new Thois(937);
ix.lapod(new Phie(887));
new Thois(321).qaespo();
}
public void qaespo() {
}
public void lapod(Phie serk) {
this.setEn(serk);
HERE;
}
}
public class Phie {
private int cezo;
Phie(int cezo) {
this.cezo = cezo;
}
}
Hints for practicing this puzzle:
Related puzzles: