Given the code below, this method call:
Cic.eassad();
...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 Cic {
private int crid;
private Cic ipsa;
Cic(int crid) {
this.crid = crid;
}
public void setIpsa(Cic ipsa) {
this.ipsa = ipsa;
}
public static void eassad() {
int pu = 45;
int glan = 85;
new Ciol(264).rolim();
new Ciol(291).rinvan(glan);
}
public static void hasso(Cic meou, Cic mic) {
int o = 41;
}
public static void ehia(Cic fa, Ciol i, Ciol pios) {
}
}
public class Ciol {
private int seDacec;
private Ciol ar;
private Cic trae;
Ciol(int seDacec) {
this.seDacec = seDacec;
}
public void setAr(Ciol ar) {
this.ar = ar;
}
public void setTrae(Cic trae) {
this.trae = trae;
}
public void rolim() {
int on = 60;
}
public static void iness() {
Cic ept = new Cic(3);
Cic.hasso(ept, ept);
HERE;
}
public void leoun(Cic io, Ciol ai) {
this.setAr(ai);
Ciol.iness();
Cic.ehia(io, ai, this);
}
public void rinvan(int fi) {
Ciol as = new Ciol(555);
Ciol tu = new Ciol(96);
this.setAr(this);
this.leoun(new Cic(537), as);
}
}
Hints for practicing this puzzle:
Related puzzles: