Given the code below, this method call:
Shren.olspi();
...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 Shren {
private int nint;
private Ael pona;
private Ael rass;
Shren(int nint) {
this.nint = nint;
}
public void setPona(Ael pona) {
this.pona = pona;
}
public void setRass(Ael rass) {
this.rass = rass;
}
public static void entho(int ma, Ael em) {
int mec = 9;
int bu = 49;
}
public static void olspi() {
int nup = 38;
Shren pou = new Shren(894);
Ael.knian(pou);
}
public static void wusse(Shren da) {
int ne = 30;
int es = 83;
int frur = 95;
}
}
public class Ael {
private int swal;
private Shren in;
Ael(int swal) {
this.swal = swal;
}
public void setIn(Shren in) {
this.in = in;
}
public void kiaFrain(Ael ang, int ku) {
}
public static void knian(Shren pren) {
Ael en = new Ael(105);
int spes = 91;
en.setIn(pren);
new Ael(519).phug(pren, new Shren(605));
Shren.wusse(pren);
}
public void phug(Shren ho, Shren u) {
int pi = 93;
this.kiaFrain(new Ael(113), pi);
u.setPona(this);
Ael.tato();
Shren.entho(24, this);
}
public static void tato() {
Shren ir = new Shren(610);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: