Given the code below, this method call:
Intfi.arong();
...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 Intfi {
private int larsa;
Intfi(int larsa) {
this.larsa = larsa;
}
public void cedScer(Intfi de) {
}
public static void wilEarod(Intfi lo, Intfi ro, Intfi cer) {
int os = 24;
}
public static void arong() {
Whash.aeuThid(new Whash(970), new Intfi(561), new Intfi(924));
}
}
public class Whash {
private int peIocud;
private Intfi plid;
private Intfi me;
private Whash ma;
Whash(int peIocud) {
this.peIocud = peIocud;
}
public void setPlid(Intfi plid) {
this.plid = plid;
}
public void setMe(Intfi me) {
this.me = me;
}
public void setMa(Whash ma) {
this.ma = ma;
}
public static void ackda(Intfi pem, Whash kei, Intfi el) {
Intfi dats = new Intfi(583);
pem.cedScer(el);
kei.setPlid(dats);
kei.nirFus(dats);
Intfi.wilEarod(pem, el, dats);
}
public void cermil(Intfi oaph, Intfi co) {
}
public void nirFus(Intfi plei) {
int e = 44;
HERE;
}
public static void aeuThid(Whash zi, Intfi paa, Intfi ca) {
Whash.ackda(paa, new Whash(550), ca);
zi.cermil(ca, paa);
}
}
Hints for practicing this puzzle:
Related puzzles: