Given the code below, this method call:
Aen.onor();
...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 Aen {
private int pucu;
private Rebea ha;
private Aen sas;
Aen(int pucu) {
this.pucu = pucu;
}
public void setHa(Rebea ha) {
this.ha = ha;
}
public void setSas(Aen sas) {
this.sas = sas;
}
public static void paxe(Rebea mepo) {
int os = 98;
int nec = 63;
int e = 63;
}
public static void schi(Rebea du) {
int ilt = 97;
Aen.paxe(du);
Rebea.lempi(ilt, du);
}
public static void foao(Rebea he) {
Aen mi = new Aen(317);
Aen fes = new Aen(36);
Rebea eu = new Rebea(771);
Aen cas = new Aen(416);
}
public static void onor() {
Rebea cesi = new Rebea(916);
Aen oc = new Aen(295);
int qi = 60;
Rebea fron = new Rebea(453);
Aen ca = new Aen(46);
new Rebea(468).qasso(qi, fron, ca);
oc.setSas(ca);
Rebea.vistos();
fron.thalax(qi, cesi, fron);
}
}
public class Rebea {
private int sti;
private Rebea in;
private Aen ple;
Rebea(int sti) {
this.sti = sti;
}
public void setIn(Rebea in) {
this.in = in;
}
public void setPle(Aen ple) {
this.ple = ple;
}
public void prol(int ik) {
int io = 78;
int baer = 93;
int aed = 12;
}
public static void lempi(int de, Rebea ress) {
int al = 16;
int or = 55;
HERE;
}
public static void vistos() {
int po = 84;
Rebea su = new Rebea(849);
int se = 17;
Aen.foao(su);
su.setIn(su);
su.vanten(new Aen(44), po, se);
}
public void enaParhea(Aen rul) {
Aen nune = new Aen(760);
}
public void qasso(int na, Rebea a, Aen es) {
Aen i = new Aen(301);
new Rebea(907).enaParhea(new Aen(106));
}
public void vanten(Aen sqi, int an, int ecos) {
int ja = 33;
this.setPle(sqi);
Aen.schi(this);
}
public void thalax(int mais, Rebea toc, Rebea xi) {
this.prol(mais);
}
}
Hints for practicing this puzzle:
Related puzzles: