Given the code below, this method call:
Oun.sapi();
...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 Oun {
private int wena;
Oun(int wena) {
this.wena = wena;
}
public void etrist(Oun veo, Iptar muac, Iptar sa) {
muac.setUism(sa);
HERE;
}
public static void sapi() {
Oun.fecaep(new Iptar(177), new Oun(100));
new Iptar(571).hurCajut();
}
public static void siuSpoud(Oun ic, Iptar gupi) {
int so = 20;
}
public static void fecaep(Iptar uu, Oun ap) {
Iptar e = new Iptar(11);
}
}
public class Iptar {
private int pses;
private Iptar ba;
private Iptar uism;
Iptar(int pses) {
this.pses = pses;
}
public void setBa(Iptar ba) {
this.ba = ba;
}
public void setUism(Iptar uism) {
this.uism = uism;
}
public void hurCajut() {
Oun deou = new Oun(690);
deou.etrist(deou, this, new Iptar(622));
Oun.siuSpoud(new Oun(1), this);
}
}
Hints for practicing this puzzle:
Related puzzles: