Given the code below, this method call:
Whest.honloc();
...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 Whest {
private int klaom;
private Ahen cimi;
Whest(int klaom) {
this.klaom = klaom;
}
public void setCimi(Ahen cimi) {
this.cimi = cimi;
}
public static void honloc() {
Whest ath = new Whest(208);
int da = 10;
Ahen.ptadol(da, ath);
new Ahen(705).honi(da, 13, new Ahen(878));
}
}
public class Ahen {
private int erAijad;
Ahen(int erAijad) {
this.erAijad = erAijad;
}
public static void ptadol(int piti, Whest ploc) {
}
public void honi(int de, int ic, Ahen bu) {
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: