Given the code below, this method call:
Ipum.aouk();
...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 Ipum {
private int idia;
private Ipum ejal;
Ipum(int idia) {
this.idia = idia;
}
public void setEjal(Ipum ejal) {
this.ejal = ejal;
}
public void piakad(Ipum ca, Ang lo, Ipum siar) {
}
public void prubla(Ipum sqa, Ipum mu) {
HERE;
new Ipum(900).piakad(mu, new Ang(100), this);
}
public static void aouk() {
Ipum seni = new Ipum(770);
seni.setEjal(seni);
seni.prubla(seni, new Ipum(399));
}
}
public class Ang {
private int teSe;
Ang(int teSe) {
this.teSe = teSe;
}
}
Hints for practicing this puzzle:
Related puzzles: