Given the code below, this method call:
Wesse.speng();
...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 Wesse {
private int gado;
private Opess uo;
Wesse(int gado) {
this.gado = gado;
}
public void setUo(Opess uo) {
this.uo = uo;
}
public static void micBimi(Wesse ac) {
int diru = 20;
int re = 41;
Wesse.sooen();
Opess.cimMoad(re);
}
public static void sooen() {
HERE;
Opess.erhe();
}
public static void speng() {
Opess.pohior(new Opess(930), new Opess(656), new Wesse(155));
new Opess(8).dimess(new Wesse(153), new Opess(849), new Wesse(429));
}
public void mert(Opess staf, Opess cono, int pism) {
int cas = 84;
this.setUo(cono);
Wesse.micBimi(this);
this.irvad(cono, 76, pism);
}
public void irvad(Opess cil, int jari, int esso) {
int ol = 69;
}
}
public class Opess {
private int oss;
private Wesse huc;
private Wesse otin;
private Wesse ciou;
Opess(int oss) {
this.oss = oss;
}
public void setHuc(Wesse huc) {
this.huc = huc;
}
public void setOtin(Wesse otin) {
this.otin = otin;
}
public void setCiou(Wesse ciou) {
this.ciou = ciou;
}
public static void pohior(Opess un, Opess ul, Wesse spi) {
Wesse en = new Wesse(585);
new Opess(197).edkep(un);
}
public void edkep(Opess eo) {
Opess wic = new Opess(362);
int pra = 89;
}
public void dimess(Wesse pa, Opess esfi, Wesse kess) {
Opess pu = new Opess(963);
pa.setUo(esfi);
kess.mert(esfi, new Opess(161), 85);
}
public static void erhe() {
int oic = 94;
int ioen = 93;
int frar = 87;
int chur = 74;
int ar = 15;
}
public static void cimMoad(int oo) {
int pior = 45;
int fa = 38;
int nian = 65;
}
}
Hints for practicing this puzzle:
Related puzzles: