Given the code below, this method call:
Shism.esmo();
...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 Shism {
private int baEn;
private Shism po;
private Phai veoc;
Shism(int baEn) {
this.baEn = baEn;
}
public void setPo(Shism po) {
this.po = po;
}
public void setVeoc(Phai veoc) {
this.veoc = veoc;
}
public static void ehuEmoss() {
int stal = 52;
HERE;
Phai.eeont(stal, stal);
}
public void pren(Shism oco, Shism trir) {
int fa = 31;
}
public static void dimuis() {
int hil = 15;
int phaw = 60;
int isas = 60;
int ad = 35;
Shism.ehuEmoss();
Phai.moagi();
}
public void kefi(Shism eo, Shism qioc, Shism ror) {
Shism eui = new Shism(369);
this.pren(qioc, eo);
qioc.setPo(this);
Phai.pocCabat();
}
public static void esmo() {
Phai urdi = new Phai(830);
Shism ci = new Shism(917);
Shism enor = new Shism(34);
Shism eope = new Shism(795);
enor.setVeoc(urdi);
enor.kefi(new Shism(849), eope, ci);
}
}
public class Phai {
private int maEspri;
private Phai cado;
private Phai iss;
Phai(int maEspri) {
this.maEspri = maEspri;
}
public void setCado(Phai cado) {
this.cado = cado;
}
public void setIss(Phai iss) {
this.iss = iss;
}
public static void demcu(int ko) {
int fla = 46;
int sopo = 88;
int flia = 85;
int elde = 45;
}
public static void pocCabat() {
int sqer = 27;
int ra = 34;
int ioca = 60;
Shism.dimuis();
Phai.demcu(sqer);
}
public static void moagi() {
}
public static void eeont(int qa, int relu) {
int dein = 48;
int da = 68;
int a = 90;
}
}
Hints for practicing this puzzle:
Related puzzles: