Given the code below, this method call:
Ocgoc.anpi();
...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 Ocgoc {
private int ouJa;
private Oso cint;
private Ocgoc lus;
Ocgoc(int ouJa) {
this.ouJa = ouJa;
}
public void setCint(Oso cint) {
this.cint = cint;
}
public void setLus(Ocgoc lus) {
this.lus = lus;
}
public static void pilep() {
int odi = 4;
}
public static void saes(int ua) {
Oso sobo = new Oso(800);
Oso jie = new Oso(219);
}
public static void anpi() {
Ocgoc.saes(24);
new Ocgoc(452).cece();
}
public void cece() {
Oso uma = new Oso(700);
Ocgoc ik = new Ocgoc(706);
this.setLus(ik);
Oso.chlunt(uma);
}
}
public class Oso {
private int rhios;
Oso(int rhios) {
this.rhios = rhios;
}
public static void chlunt(Oso cri) {
Ocgoc lec = new Ocgoc(449);
int wec = 50;
Ocgoc.pilep();
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: