Given the code below, this method call:
Docim.soiuar();
...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 Docim {
private int cecdi;
Docim(int cecdi) {
this.cecdi = cecdi;
}
public static void soiuar() {
int bemi = 65;
int sini = 25;
int sce = 15;
Docim troe = new Docim(563);
new Fli(40).whafia(34);
}
public void mismu(Fli glon, Fli vami, Docim liot) {
}
public static void dekuc(int zeu, Fli peoc) {
Fli il = new Fli(993);
}
}
public class Fli {
private int esmo;
private Fli nu;
private Docim spo;
private Docim be;
Fli(int esmo) {
this.esmo = esmo;
}
public void setNu(Fli nu) {
this.nu = nu;
}
public void setSpo(Docim spo) {
this.spo = spo;
}
public void setBe(Docim be) {
this.be = be;
}
public void ashwar(Docim le, Fli is, int rost) {
new Docim(615).mismu(this, new Fli(187), le);
is.setSpo(le);
is.ontca();
}
public void shoc(Docim ec, int u, Fli ong) {
}
public void ontca() {
int teci = 81;
Docim.dekuc(21, this);
HERE;
}
public void whafia(int ic) {
Fli odpi = new Fli(853);
odpi.setNu(this);
this.ashwar(new Docim(243), this, ic);
odpi.shoc(new Docim(185), ic, odpi);
}
}
Hints for practicing this puzzle:
Related puzzles: