Given the code below, this method call:
Erfle.degec();
...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 Erfle {
private int esgep;
private Erfle ki;
Erfle(int esgep) {
this.esgep = esgep;
}
public void setKi(Erfle ki) {
this.ki = ki;
}
public static void degec() {
new Nouc(808).cenbom(new Erfle(749));
}
}
public class Nouc {
private int rai;
Nouc(int rai) {
this.rai = rai;
}
public static void thess() {
}
public void cenbom(Erfle um) {
um.setKi(um);
HERE;
Nouc.thess();
}
}
Hints for practicing this puzzle:
Related puzzles: