Given the code below, this method call:
Erong.bardhi();
...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 Erong {
private int resou;
private Rar umel;
private Erong isdo;
Erong(int resou) {
this.resou = resou;
}
public void setUmel(Rar umel) {
this.umel = umel;
}
public void setIsdo(Erong isdo) {
this.isdo = isdo;
}
public static void bardhi() {
Rar oul = new Rar(629);
new Erong(823).peant();
oul.ruiw(oul, oul);
}
public void peant() {
Rar.wisbid(77, new Rar(599));
Erong.banso(new Erong(94), this, new Erong(625));
}
public static void banso(Erong upe, Erong lihu, Erong onsu) {
onsu.setIsdo(lihu);
HERE;
}
}
public class Rar {
private int alPri;
Rar(int alPri) {
this.alPri = alPri;
}
public void ruiw(Rar pu, Rar teou) {
}
public static void wisbid(int phip, Rar ai) {
Erong fel = new Erong(165);
}
}
Hints for practicing this puzzle:
Related puzzles: