Given the code below, this method call:
Eught.renuil();
...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 Eught {
private int clul;
Eught(int clul) {
this.clul = clul;
}
public static void ortam() {
int eck = 59;
int bri = 8;
}
public static void abrec() {
Biu fect = new Biu(266);
Biu asbo = new Biu(953);
int seng = 41;
}
public static void kaspel() {
Eught.abrec();
new Biu(274).nadol(new Biu(277), new Biu(919), new Eught(697));
}
public static void renuil() {
Eught.kaspel();
}
}
public class Biu {
private int falet;
private Eught es;
private Biu tek;
Biu(int falet) {
this.falet = falet;
}
public void setEs(Eught es) {
this.es = es;
}
public void setTek(Biu tek) {
this.tek = tek;
}
public void nadol(Biu lasm, Biu gi, Eught poc) {
gi.setEs(poc);
HERE;
Eught.ortam();
}
}
Hints for practicing this puzzle:
Related puzzles: