Given the code below, this method call:
Pafer.hioScro();
...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 Pafer {
private int noDungu;
private Pafer ir;
Pafer(int noDungu) {
this.noDungu = noDungu;
}
public void setIr(Pafer ir) {
this.ir = ir;
}
public static void piafed(Pafer eded, Flur disi, int hea) {
}
public static void hioScro() {
Pafer pral = new Pafer(244);
Pafer.piafed(pral, new Flur(891), 8);
pral.setIr(pral);
new Flur(878).emol(pral);
}
}
public class Flur {
private int teChlo;
private Flur whek;
private Flur shas;
Flur(int teChlo) {
this.teChlo = teChlo;
}
public void setWhek(Flur whek) {
this.whek = whek;
}
public void setShas(Flur shas) {
this.shas = shas;
}
public void iang(Pafer li) {
Flur glac = new Flur(934);
int ud = 17;
}
public void piar() {
Flur ziu = new Flur(220);
this.prour(ziu);
this.nelVou(ziu, this, new Flur(645));
}
public void nelVou(Flur rer, Flur sa, Flur qo) {
}
public void prour(Flur iant) {
Pafer awer = new Pafer(322);
HERE;
}
public void emol(Pafer upe) {
this.setShas(this);
this.piar();
new Flur(948).iang(upe);
}
}
Hints for practicing this puzzle:
Related puzzles: