Given the code below, this method call:
Nesku.mocal();
...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 Nesku {
private int eiUism;
private Pso es;
private Pso psa;
private Pso pi;
Nesku(int eiUism) {
this.eiUism = eiUism;
}
public void setEs(Pso es) {
this.es = es;
}
public void setPsa(Pso psa) {
this.psa = psa;
}
public void setPi(Pso pi) {
this.pi = pi;
}
public void poumer(Pso fla, Pso duac) {
int grul = 26;
Pso.irsing(this, duac, grul);
this.setEs(duac);
Pso.lengsu(grul);
}
public void pling(Nesku or, int sioc) {
int stoc = 8;
Nesku.riolre(sioc, stoc, or);
}
public void ealhuk(int re, Nesku ekeo, int pel) {
int teur = 53;
}
public static void tris() {
int hiol = 42;
int am = 57;
int fii = 0;
}
public static void mocal() {
int ba = 9;
Nesku fo = new Nesku(367);
Nesku wo = new Nesku(79);
int ji = 65;
Nesku.pnaeo(ba, ji, new Nesku(965));
new Pso(146).pertes(new Nesku(811));
fo.pling(fo, ji);
}
public static void riolre(int weas, int ermi, Nesku orp) {
int erp = 35;
}
public static void cecon(int sti, int ovec) {
int ad = 59;
HERE;
}
public static void pnaeo(int mi, int amo, Nesku ouna) {
int paat = 56;
int acep = 67;
ouna.ealhuk(paat, new Nesku(569), mi);
}
}
public class Pso {
private int woda;
private Nesku ded;
Pso(int woda) {
this.woda = woda;
}
public void setDed(Nesku ded) {
this.ded = ded;
}
public static void irsing(Nesku smir, Pso bu, int an) {
int bla = 63;
}
public void pertes(Nesku vi) {
vi.setEs(this);
new Nesku(229).poumer(new Pso(837), this);
}
public static void lengsu(int deng) {
int hi = 22;
int caco = 48;
int al = 9;
int terl = 80;
Nesku.cecon(7, deng);
Nesku.tris();
}
}
Hints for practicing this puzzle:
Related puzzles: