Given the code below, this method call:
Ossin.siap();
...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 Ossin {
private int iol;
private Ebant nuil;
private Ebant neae;
Ossin(int iol) {
this.iol = iol;
}
public void setNuil(Ebant nuil) {
this.nuil = nuil;
}
public void setNeae(Ebant neae) {
this.neae = neae;
}
public static void siap() {
Ossin dass = new Ossin(40);
Ebant tham = new Ebant(901);
Ebant eler = new Ebant(801);
Ossin.treRaci(dass, tham, eler);
new Ossin(657).centse();
}
public void cabe(int vae, int du, Ossin ku) {
this.rhic(this);
HERE;
}
public void rhic(Ossin li) {
int on = 25;
}
public static void treRaci(Ossin od, Ebant dism, Ebant meae) {
}
public void centse() {
int ced = 80;
int ni = 36;
this.cabe(ni, ced, this);
}
}
public class Ebant {
private int eanod;
Ebant(int eanod) {
this.eanod = eanod;
}
}
Hints for practicing this puzzle:
Related puzzles: