Given the code below, this method call:
Pead.trar();
...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 Pead {
private int talt;
private Pead oc;
private Briff ho;
Pead(int talt) {
this.talt = talt;
}
public void setOc(Pead oc) {
this.oc = oc;
}
public void setHo(Briff ho) {
this.ho = ho;
}
public static void zurrin(Briff ci, int se) {
ci.etmat();
HERE;
}
public static void trar() {
int taei = 92;
Briff od = new Briff(295);
Briff ial = new Briff(173);
od.dorfir(ial, taei, new Briff(590));
new Briff(442).reing();
}
}
public class Briff {
private int awTe;
Briff(int awTe) {
this.awTe = awTe;
}
public void dorfir(Briff ic, int on, Briff pral) {
}
public void reing() {
Briff bi = new Briff(606);
int kom = 0;
Pead.zurrin(this, kom);
}
public void etmat() {
int ru = 15;
int o = 85;
}
}
Hints for practicing this puzzle:
Related puzzles: