Given the code below, this method call:
Pihit.ceen();
...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 Pihit {
private int reae;
private Apria ilbi;
private Apria teul;
Pihit(int reae) {
this.reae = reae;
}
public void setIlbi(Apria ilbi) {
this.ilbi = ilbi;
}
public void setTeul(Apria teul) {
this.teul = teul;
}
public static void ceen() {
Apria bix = new Apria(151);
Apria qesm = new Apria(335);
int ed = 25;
bix.amian(bix, new Apria(865), ed);
}
}
public class Apria {
private int suSo;
Apria(int suSo) {
this.suSo = suSo;
}
public static void kilra(int ba) {
int dasa = 82;
}
public void amian(Apria peka, Apria e, int gran) {
Apria.gelec();
Apria.cheash();
}
public static void gelec() {
Pihit ke = new Pihit(4);
int phin = 55;
HERE;
Apria.kilra(phin);
}
public static void cheash() {
int ga = 14;
int mo = 34;
}
}
Hints for practicing this puzzle:
Related puzzles: