Given the code below, this method call:
Ston.soff();
...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 Ston {
private int deu;
private Irent uth;
private Ston nel;
Ston(int deu) {
this.deu = deu;
}
public void setUth(Irent uth) {
this.uth = uth;
}
public void setNel(Ston nel) {
this.nel = nel;
}
public static void ussOsiec(Irent suic, Irent er) {
int hi = 46;
int oi = 54;
int esqi = 19;
}
public static void metuc(Irent nept, Ston ic) {
}
public static void soff() {
Irent thas = new Irent(681);
Irent wou = new Irent(334);
new Ston(516).cherca(wou, new Irent(209), thas);
wou.tria(wou);
Irent.nerSaras(wou);
}
public static void raha(int cec) {
int gec = 47;
}
public static void stussa(int dul, int ar, int eex) {
int esh = 13;
HERE;
Irent.pheoc(eex, esh);
}
public void cherca(Irent glea, Irent hoet, Irent joc) {
int ceck = 16;
Ston.metuc(hoet, new Ston(177));
}
}
public class Irent {
private int wal;
private Ston id;
private Ston odim;
Irent(int wal) {
this.wal = wal;
}
public void setId(Ston id) {
this.id = id;
}
public void setOdim(Ston odim) {
this.odim = odim;
}
public static void pheoc(int pid, int nust) {
int se = 39;
int no = 35;
}
public void tria(Irent chra) {
Irent cel = new Irent(342);
Irent ve = new Irent(712);
cel.eousm();
}
public static void ocsOrdent() {
int ous = 31;
int gren = 79;
int bre = 88;
Ston.stussa(bre, gren, ous);
}
public static void nerSaras(Irent od) {
Ston.ussOsiec(od, od);
}
public void eousm() {
Irent ick = new Irent(434);
int icac = 19;
Ston si = new Ston(776);
int icur = 79;
Ston.raha(icur);
this.setOdim(si);
Irent.ocsOrdent();
}
}
Hints for practicing this puzzle:
Related puzzles: