Given the code below, this method call:
Ouss.fidbel();
...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 Ouss {
private int viSas;
private Zano mec;
private Ouss omel;
Ouss(int viSas) {
this.viSas = viSas;
}
public void setMec(Zano mec) {
this.mec = mec;
}
public void setOmel(Ouss omel) {
this.omel = omel;
}
public static void fidbel() {
Ouss moin = new Ouss(612);
int icin = 39;
new Zano(84).iber(icin);
}
public void enass() {
this.setOmel(this);
Zano.anner(this, this);
Ouss.eswizz(this);
}
public static void eswizz(Ouss ir) {
int erda = 2;
}
public void eaemo() {
int deng = 89;
int fu = 84;
int it = 80;
int eacu = 61;
}
public void sotest(int iis, int ror) {
int oss = 69;
}
public void liont(int desm, Ouss pe) {
Ouss vesa = new Ouss(714);
int no = 19;
this.setOmel(vesa);
new Ouss(610).enass();
this.eaemo();
}
public void paiPhenel() {
int bil = 4;
int cang = 72;
int leou = 82;
}
}
public class Zano {
private int ooa;
private Ouss moou;
private Ouss vam;
Zano(int ooa) {
this.ooa = ooa;
}
public void setMoou(Ouss moou) {
this.moou = moou;
}
public void setVam(Ouss vam) {
this.vam = vam;
}
public static void anner(Ouss irt, Ouss su) {
int oin = 74;
int cec = 51;
su.sotest(cec, oin);
HERE;
irt.paiPhenel();
}
public void iber(int sor) {
Ouss sto = new Ouss(760);
this.setVam(sto);
new Ouss(326).liont(sor, sto);
}
}
Hints for practicing this puzzle:
Related puzzles: