Given the code below, this method call:
Spod.tolni();
...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 Spod {
private int jiho;
private Qopru osla;
Spod(int jiho) {
this.jiho = jiho;
}
public void setOsla(Qopru osla) {
this.osla = osla;
}
public static void tolni() {
new Qopru(108).tintmi(new Spod(683));
Qopru.mongma();
}
public static void ghac() {
Qopru de = new Qopru(0);
int i = 51;
HERE;
}
public static void psel(Spod sibi, Qopru eup) {
int noss = 94;
}
}
public class Qopru {
private int vodeu;
private Spod asgi;
Qopru(int vodeu) {
this.vodeu = vodeu;
}
public void setAsgi(Spod asgi) {
this.asgi = asgi;
}
public static void mongma() {
}
public void tintmi(Spod en) {
Qopru e = new Qopru(747);
e.setAsgi(en);
Spod.ghac();
Spod.psel(en, e);
}
}
Hints for practicing this puzzle:
Related puzzles: