Given the code below, this method call:
Ouss.dontro();
...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 Ouss {
private int coSti;
private Sodha te;
Ouss(int coSti) {
this.coSti = coSti;
}
public void setTe(Sodha te) {
this.te = te;
}
public static void dontro() {
Ouss.wamod(new Sodha(653));
}
public static void wamod(Sodha toc) {
Sodha ri = new Sodha(410);
Sodha cusm = new Sodha(471);
Sodha.gian(cusm, toc, new Ouss(253));
Ouss.elposm(cusm, toc);
}
public static void elposm(Sodha uiol, Sodha ad) {
Sodha dant = new Sodha(216);
HERE;
dant.cillo(ad);
}
}
public class Sodha {
private int zeCe;
private Ouss coti;
Sodha(int zeCe) {
this.zeCe = zeCe;
}
public void setCoti(Ouss coti) {
this.coti = coti;
}
public void cillo(Sodha an) {
}
public static void gian(Sodha phem, Sodha tism, Ouss vap) {
}
}
Hints for practicing this puzzle:
Related puzzles: