Given the code below, this method call:
Dibad.whoud();
...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 Dibad {
private int ecwe;
private Dibad truc;
private Birci fe;
Dibad(int ecwe) {
this.ecwe = ecwe;
}
public void setTruc(Dibad truc) {
this.truc = truc;
}
public void setFe(Birci fe) {
this.fe = fe;
}
public static void iatSwent(Dibad ip) {
int orse = 98;
int hass = 18;
int sne = 75;
Birci.snouu(orse, sne);
HERE;
}
public void iocLabos(Dibad mie, Birci fa, Birci ti) {
}
public static void whoud() {
Birci wu = new Birci(198);
Dibad iur = new Dibad(75);
new Birci(414).phid(iur, new Dibad(43), 59);
wu.setUcnu(wu);
new Birci(6).issCrifhe();
iur.iocLabos(iur, wu, wu);
}
}
public class Birci {
private int balid;
private Birci ucnu;
Birci(int balid) {
this.balid = balid;
}
public void setUcnu(Birci ucnu) {
this.ucnu = ucnu;
}
public void issCrifhe() {
this.setUcnu(this);
new Birci(576).bikot(91, new Dibad(573), this);
}
public void phid(Dibad phel, Dibad eae, int mi) {
}
public void bikot(int iati, Dibad bia, Birci phet) {
Dibad.iatSwent(bia);
}
public static void snouu(int ecir, int adus) {
}
}
Hints for practicing this puzzle:
Related puzzles: