Given the code below, this method call:
Phirk.shon();
...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 Phirk {
private int dusm;
private Nass bir;
private Nass fias;
Phirk(int dusm) {
this.dusm = dusm;
}
public void setBir(Nass bir) {
this.bir = bir;
}
public void setFias(Nass fias) {
this.fias = fias;
}
public void miwCessic(Nass glec, Phirk et) {
}
public static void shon() {
int ot = 70;
Phirk co = new Phirk(692);
Nass.usqol(ot, new Phirk(126));
Nass.esess();
}
}
public class Nass {
private int ungo;
Nass(int ungo) {
this.ungo = ungo;
}
public void iopuc() {
int mafi = 37;
int ir = 97;
HERE;
}
public static void usqol(int fo, Phirk mio) {
Nass pai = new Nass(845);
mio.setBir(pai);
pai.iopuc();
mio.miwCessic(pai, mio);
}
public static void esess() {
int mo = 68;
Phirk clia = new Phirk(88);
Nass ma = new Nass(206);
}
}
Hints for practicing this puzzle:
Related puzzles: