Given the code below, this method call:
Senia.kapen();
...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 Senia {
private int bohid;
Senia(int bohid) {
this.bohid = bohid;
}
public static void kapen() {
int os = 1;
Veba pou = new Veba(696);
new Senia(367).mael();
new Veba(181).uroal();
}
public void mael() {
Senia pa = new Senia(432);
int tio = 56;
}
}
public class Veba {
private int eid;
private Senia siet;
private Senia ofra;
Veba(int eid) {
this.eid = eid;
}
public void setSiet(Senia siet) {
this.siet = siet;
}
public void setOfra(Senia ofra) {
this.ofra = ofra;
}
public void uroal() {
int di = 77;
this.butem(new Senia(245), this, di);
Veba.irnGec();
}
public void butem(Senia omog, Veba o, int fale) {
this.setOfra(omog);
HERE;
}
public static void irnGec() {
Senia oruc = new Senia(64);
int psoa = 97;
int ad = 62;
}
}
Hints for practicing this puzzle:
Related puzzles: