Given the code below, this method call:
Osna.hosMio();
...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 Osna {
private int entce;
private Ourt inec;
Osna(int entce) {
this.entce = entce;
}
public void setInec(Ourt inec) {
this.inec = inec;
}
public static void ramos(Ourt endu) {
HERE;
Ourt.xast();
}
public static void fesmis(Ourt elot) {
Ourt la = new Ourt(981);
Ourt hetu = new Ourt(183);
int mi = 63;
hetu.setVaha(la);
Osna.ramos(hetu);
Osna.irdLusesh();
}
public static void irdLusesh() {
}
public static void hosMio() {
Ourt.uwre(new Ourt(79), new Ourt(355), new Osna(193));
}
}
public class Ourt {
private int liHi;
private Osna co;
private Ourt vaha;
Ourt(int liHi) {
this.liHi = liHi;
}
public void setCo(Osna co) {
this.co = co;
}
public void setVaha(Ourt vaha) {
this.vaha = vaha;
}
public static void xast() {
}
public void ontir() {
int ki = 17;
int um = 65;
}
public static void uwre(Ourt rean, Ourt isha, Osna sler) {
rean.setVaha(isha);
Osna.fesmis(isha);
isha.ontir();
}
}
Hints for practicing this puzzle:
Related puzzles: