Given the code below, this method call:
Daul.fergam();
...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 Daul {
private int ewen;
private Daul ekew;
Daul(int ewen) {
this.ewen = ewen;
}
public void setEkew(Daul ekew) {
this.ekew = ekew;
}
public static void fergam() {
Daul ce = new Daul(233);
Crelt ilas = new Crelt(415);
new Crelt(406).sleng();
ce.setEkew(ce);
Crelt.urthuc(new Daul(315));
}
public static void oilme(Daul ciga, Daul onio) {
int rios = 1;
HERE;
}
public void gaudul(Daul rer, Daul nu, Daul ple) {
}
}
public class Crelt {
private int boje;
private Crelt fepe;
Crelt(int boje) {
this.boje = boje;
}
public void setFepe(Crelt fepe) {
this.fepe = fepe;
}
public void sleng() {
}
public static void urthuc(Daul ste) {
ste.setEkew(ste);
Daul.oilme(ste, new Daul(396));
ste.gaudul(ste, ste, ste);
}
}
Hints for practicing this puzzle:
Related puzzles: