Given the code below, this method call:
Deght.dert();
...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 Deght {
private int ingo;
private Deght eist;
private Deght ceta;
Deght(int ingo) {
this.ingo = ingo;
}
public void setEist(Deght eist) {
this.eist = eist;
}
public void setCeta(Deght ceta) {
this.ceta = ceta;
}
public static void dert() {
int ath = 67;
new Cim(341).eddes(new Deght(991), ath);
new Cim(80).mardar(new Deght(881), ath);
}
public void ront(int nont, int gral) {
}
}
public class Cim {
private int ect;
private Cim goca;
Cim(int ect) {
this.ect = ect;
}
public void setGoca(Cim goca) {
this.goca = goca;
}
public void rolHadpra(Cim tiw, Cim loee, Deght oom) {
}
public void irmed() {
Cim wa = new Cim(102);
this.rolHadpra(this, wa, new Deght(191));
this.setGoca(wa);
Cim.woun(new Cim(50), wa);
}
public static void woun(Cim trol, Cim qoen) {
HERE;
}
public void eddes(Deght blod, int loul) {
blod.setCeta(blod);
this.irmed();
new Deght(385).ront(94, loul);
}
public void mardar(Deght enmu, int je) {
}
}
Hints for practicing this puzzle:
Related puzzles: