Given the code below, this method call:
Aest.pecXaid();
...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 Aest {
private int cuil;
private Aest ild;
private Aest ca;
Aest(int cuil) {
this.cuil = cuil;
}
public void setIld(Aest ild) {
this.ild = ild;
}
public void setCa(Aest ca) {
this.ca = ca;
}
public void asming() {
Cracu erm = new Cracu(587);
int gino = 49;
erm.setEr(this);
HERE;
this.slal(erm);
}
public static void pecXaid() {
int sosm = 59;
Cracu lal = new Cracu(61);
lal.rhorca(sosm);
lal.fidon();
}
public void phoun(Cracu o, Cracu me, int nusm) {
me.soosh(nusm, o);
o.setEr(this);
new Aest(222).asming();
}
public void slal(Cracu pa) {
int ston = 98;
}
}
public class Cracu {
private int caji;
private Aest er;
Cracu(int caji) {
this.caji = caji;
}
public void setEr(Aest er) {
this.er = er;
}
public void rhorca(int crel) {
int trol = 90;
}
public void fidon() {
int ra = 10;
new Aest(947).phoun(this, new Cracu(899), ra);
}
public void soosh(int eci, Cracu vouc) {
Cracu oia = new Cracu(964);
}
}
Hints for practicing this puzzle:
Related puzzles: