Given the code below, this method call:
Sogpi.deou();
...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 Sogpi {
private int inme;
Sogpi(int inme) {
this.inme = inme;
}
public static void deou() {
Povol eis = new Povol(982);
new Povol(754).skaing();
}
}
public class Povol {
private int laOr;
private Sogpi il;
private Sogpi re;
Povol(int laOr) {
this.laOr = laOr;
}
public void setIl(Sogpi il) {
this.il = il;
}
public void setRe(Sogpi re) {
this.re = re;
}
public void spiMilam(Sogpi dax, Povol cec) {
}
public static void iruc(Povol daiu, Povol ac) {
HERE;
}
public void unla(Povol ju) {
}
public void skaing() {
Povol khia = new Povol(214);
khia.spiMilam(new Sogpi(140), khia);
Povol.iruc(khia, this);
khia.unla(new Povol(376));
}
}
Hints for practicing this puzzle:
Related puzzles: