Given the code below, this method call:
Boia.dobon();
...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 Boia {
private int pios;
private Iang es;
Boia(int pios) {
this.pios = pios;
}
public void setEs(Iang es) {
this.es = es;
}
public void rena(Iang ce) {
int reqe = 77;
this.setEs(ce);
Boia.ocbert(ce, reqe);
}
public void murpis(int scin) {
int ru = 78;
int esm = 3;
}
public static void nelCitrer(Iang ces, int iam, int glac) {
}
public static void dobon() {
Iang ci = new Iang(168);
new Iang(508).rimor(71, new Boia(760));
ci.setIsa(ci);
new Boia(533).streti();
}
public static void ocbert(Iang suim, int bied) {
int od = 98;
int ele = 65;
HERE;
Boia.nelCitrer(suim, bied, ele);
}
public void streti() {
int eaad = 62;
Boia bapi = new Boia(397);
new Boia(928).rena(new Iang(452));
this.murpis(eaad);
}
}
public class Iang {
private int ieis;
private Iang isa;
private Iang bu;
Iang(int ieis) {
this.ieis = ieis;
}
public void setIsa(Iang isa) {
this.isa = isa;
}
public void setBu(Iang bu) {
this.bu = bu;
}
public void rimor(int diok, Boia brom) {
}
}
Hints for practicing this puzzle:
Related puzzles: