Given the code below, this method call:
Nelt.ongce();
...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 Nelt {
private int wuUcit;
private Gesm tre;
Nelt(int wuUcit) {
this.wuUcit = wuUcit;
}
public void setTre(Gesm tre) {
this.tre = tre;
}
public void buhon() {
Gesm mo = new Gesm(195);
this.setTre(mo);
HERE;
}
public static void ongce() {
new Nelt(472).buhon();
Gesm.ostMogler();
}
}
public class Gesm {
private int voRo;
Gesm(int voRo) {
this.voRo = voRo;
}
public static void ostMogler() {
}
}
Hints for practicing this puzzle:
Related puzzles: