Given the code below, this method call:
Moen.isonn();
...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 Moen {
private int cuc;
private Tring al;
private Moen sesm;
Moen(int cuc) {
this.cuc = cuc;
}
public void setAl(Tring al) {
this.al = al;
}
public void setSesm(Moen sesm) {
this.sesm = sesm;
}
public static void isonn() {
int essi = 94;
int oc = 16;
Moen su = new Moen(33);
new Moen(764).olir(oc, su);
su.setSesm(su);
new Tring(327).wusi(oc);
}
public static void zaing(Tring no) {
Moen tru = new Moen(460);
Moen nost = new Moen(330);
Tring.steseu(tru);
}
public static void pocre() {
int iil = 82;
}
public void olir(int iass, Moen ipen) {
int rac = 36;
}
}
public class Tring {
private int plar;
private Moen nue;
Tring(int plar) {
this.plar = plar;
}
public void setNue(Moen nue) {
this.nue = nue;
}
public static void steseu(Moen hai) {
HERE;
}
public void thiPric(int ska) {
Tring ec = new Tring(92);
Tring khia = new Tring(522);
}
public void wusi(int upi) {
int ka = 89;
Moen ond = new Moen(617);
this.thiPric(upi);
this.setNue(ond);
Moen.zaing(this);
Moen.pocre();
}
}
Hints for practicing this puzzle:
Related puzzles: