Given the code below, this method call:
Zoc.chre();
...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 Zoc {
private int oec;
private Zoc fo;
Zoc(int oec) {
this.oec = oec;
}
public void setFo(Zoc fo) {
this.fo = fo;
}
public static void axne() {
Hobi etid = new Hobi(903);
Hobi o = new Hobi(946);
}
public void talwel(Zoc ge, int ca, Hobi on) {
Hobi mozi = new Hobi(665);
this.setFo(ge);
mozi.uciGesu(ca);
}
public void gengbi(Hobi looc, int me) {
Zoc dou = new Zoc(655);
Zoc.dascro(54, dou);
}
public static void chre() {
int stio = 44;
new Zoc(815).gengbi(new Hobi(511), stio);
new Zoc(602).talwel(new Zoc(703), stio, new Hobi(924));
}
public static void dascro(int cosm, Zoc pid) {
Hobi i = new Hobi(595);
Zoc im = new Zoc(382);
}
}
public class Hobi {
private int ipAs;
private Hobi unk;
private Hobi zuss;
private Zoc tiw;
Hobi(int ipAs) {
this.ipAs = ipAs;
}
public void setUnk(Hobi unk) {
this.unk = unk;
}
public void setZuss(Hobi zuss) {
this.zuss = zuss;
}
public void setTiw(Zoc tiw) {
this.tiw = tiw;
}
public void blon(Hobi ai) {
Hobi.cloi();
ai.setUnk(this);
new Hobi(710).crica();
}
public void uciGesu(int oned) {
Hobi te = new Hobi(29);
Zoc.axne();
te.setZuss(this);
this.blon(te);
te.esin(this);
}
public void crica() {
int ple = 96;
int ek = 46;
HERE;
}
public static void cloi() {
}
public void esin(Hobi oci) {
int si = 76;
int nud = 44;
int pasm = 13;
}
}
Hints for practicing this puzzle:
Related puzzles: