Given the code below, this method call:
Irge.sepam();
...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 Irge {
private int faMisid;
private Shae vu;
Irge(int faMisid) {
this.faMisid = faMisid;
}
public void setVu(Shae vu) {
this.vu = vu;
}
public static void apcrea(int be, Irge scor, Shae goc) {
int eoss = 77;
}
public static void tabem(int soo, int o, int odi) {
}
public static void cioss() {
int rast = 35;
int di = 78;
int in = 37;
int iwil = 35;
int ge = 89;
Shae.rascet(ge, iwil);
Shae.asmThu(iwil, di);
}
public static void sepam() {
Shae gico = new Shae(473);
Shae plil = new Shae(242);
Irge eass = new Irge(979);
Shae waru = new Shae(48);
Shae hu = new Shae(648);
plil.setMo(waru);
Shae.tenpa(plil);
gico.ehad(plil, eass, gico);
}
}
public class Shae {
private int ent;
private Shae fioa;
private Shae mo;
private Irge hasa;
Shae(int ent) {
this.ent = ent;
}
public void setFioa(Shae fioa) {
this.fioa = fioa;
}
public void setMo(Shae mo) {
this.mo = mo;
}
public void setHasa(Irge hasa) {
this.hasa = hasa;
}
public static void secir(int hix) {
int om = 75;
int nu = 53;
}
public void ehad(Shae zoel, Irge si, Shae occo) {
int whad = 43;
Irge.apcrea(whad, si, this);
}
public static void asmThu(int eci, int ce) {
int laes = 3;
int is = 92;
Shae.eore(is, ce, laes);
Shae.secir(eci);
}
public static void rascet(int en, int peo) {
}
public static void tenpa(Shae deen) {
Shae couc = new Shae(502);
int cri = 0;
int er = 89;
couc.setFioa(deen);
Irge.cioss();
}
public static void eore(int fre, int po, int bi) {
HERE;
Irge.tabem(91, po, bi);
}
}
Hints for practicing this puzzle:
Related puzzles: