Given the code below, this method call:
Punda.icri();
...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 Punda {
private int aphes;
private Punda id;
Punda(int aphes) {
this.aphes = aphes;
}
public void setId(Punda id) {
this.id = id;
}
public void cesa(Punda idon) {
Punda ro = new Punda(889);
}
public static void icri() {
int vu = 69;
Qasuc iphu = new Qasuc(519);
new Punda(817).eong();
}
public void eong() {
Qasuc je = new Qasuc(524);
new Punda(446).cesa(new Punda(935));
je.setIc(this);
Qasuc.puti();
je.suaAlcin();
}
}
public class Qasuc {
private int esles;
private Punda ic;
Qasuc(int esles) {
this.esles = esles;
}
public void setIc(Punda ic) {
this.ic = ic;
}
public void suaAlcin() {
int phre = 91;
int i = 97;
}
public static void puti() {
Punda ri = new Punda(50);
int kash = 61;
ri.setId(ri);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: