Given the code below, this method call:
Thes.eweph();
...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 Thes {
private int bixde;
private Thes li;
private Thes leic;
private Thes scul;
Thes(int bixde) {
this.bixde = bixde;
}
public void setLi(Thes li) {
this.li = li;
}
public void setLeic(Thes leic) {
this.leic = leic;
}
public void setScul(Thes scul) {
this.scul = scul;
}
public void iulch(Moshi audi, Thes zia, int biss) {
int abai = 51;
HERE;
this.chosm(this, abai, zia);
}
public void chosm(Thes ules, int he, Thes mida) {
}
public static void jaaRudren(int er, int phii, Moshi oce) {
new Thes(318).snica();
}
public void snica() {
Thes cec = new Thes(395);
cec.setLeic(this);
new Thes(905).thul();
this.qismgi(cec, 21);
}
public void thul() {
Moshi ma = new Moshi(144);
int edio = 15;
Moshi.erci(ma, this, edio);
ma.setNilt(this);
this.iulch(ma, this, edio);
}
public static void goci(int ai) {
int bia = 23;
int imon = 51;
}
public void qismgi(Thes ong, int pne) {
int glae = 57;
}
public static void eweph() {
int et = 9;
Thes hane = new Thes(560);
int mo = 85;
int pren = 73;
hane.setLeic(hane);
Thes.jaaRudren(et, pren, new Moshi(661));
Moshi.truInva(et, mo);
}
}
public class Moshi {
private int ede;
private Thes nilt;
Moshi(int ede) {
this.ede = ede;
}
public void setNilt(Thes nilt) {
this.nilt = nilt;
}
public static void erci(Moshi hi, Thes jeti, int gia) {
}
public static void truInva(int phid, int whuc) {
Thes.goci(phid);
}
}
Hints for practicing this puzzle:
Related puzzles: