Given the code below, this method call:
Heene.diacfi();
...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 Heene {
private int busom;
private Spoel le;
private Spoel me;
Heene(int busom) {
this.busom = busom;
}
public void setLe(Spoel le) {
this.le = le;
}
public void setMe(Spoel me) {
this.me = me;
}
public void sedhia() {
Heene mi = new Heene(102);
int pric = 40;
int ac = 15;
this.wess(pric, 74, mi);
Spoel.osuss(ac, mi, pric);
Spoel.risli(mi, pric, ac);
}
public static void diacfi() {
Heene rhed = new Heene(949);
new Heene(457).uannes(rhed, new Spoel(141));
}
public void uannes(Heene pu, Spoel soi) {
Heene eca = new Heene(761);
Spoel.gleAhank(soi, new Heene(237), this);
eca.setMe(soi);
eca.sedhia();
}
public void wess(int wic, int qi, Heene pso) {
}
}
public class Spoel {
private int psess;
private Spoel cel;
Spoel(int psess) {
this.psess = psess;
}
public void setCel(Spoel cel) {
this.cel = cel;
}
public static void risli(Heene ro, int ir, int iom) {
int scru = 28;
}
public static void gleAhank(Spoel vess, Heene naki, Heene niae) {
}
public static void osuss(int piil, Heene ces, int o) {
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: