Given the code below, this method call:
Bopra.cipoc();
...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 Bopra {
private int osm;
private Bopra goei;
private Bopra siu;
Bopra(int osm) {
this.osm = osm;
}
public void setGoei(Bopra goei) {
this.goei = goei;
}
public void setSiu(Bopra siu) {
this.siu = siu;
}
public static void cipoc() {
int ong = 66;
Bopra sle = new Bopra(883);
new Ipu(468).muesh(new Bopra(626));
sle.setGoei(sle);
new Ipu(891).enbuel(new Ipu(107), ong);
}
public static void irec(Bopra ui, Ipu pe, int tre) {
int icoc = 99;
Ipu.spafi(42);
Ipu.sucGlata(ui);
}
}
public class Ipu {
private int weIsste;
private Ipu ules;
Ipu(int weIsste) {
this.weIsste = weIsste;
}
public void setUles(Ipu ules) {
this.ules = ules;
}
public static void spafi(int iun) {
int ur = 74;
HERE;
}
public void muesh(Bopra miud) {
Ipu mece = new Ipu(737);
Ipu ce = new Ipu(527);
}
public static void itrec(Bopra as) {
int u = 75;
int si = 55;
int co = 23;
}
public void enbuel(Ipu ro, int e) {
Bopra me = new Bopra(183);
ro.setUles(this);
Bopra.irec(me, new Ipu(166), e);
Ipu.itrec(me);
}
public static void sucGlata(Bopra ili) {
}
}
Hints for practicing this puzzle:
Related puzzles: