Given the code below, this method call:
Hul.ieoPitul();
...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 Hul {
private int somus;
private Cer cex;
Hul(int somus) {
this.somus = somus;
}
public void setCex(Cer cex) {
this.cex = cex;
}
public static void ieoPitul() {
int so = 74;
Cer.jolbac();
new Cer(617).comor(new Cer(827), so, new Cer(324));
}
public void upes(Cer ount, int et) {
Cer.ounCecia(et);
ount.setRe(this);
HERE;
}
}
public class Cer {
private int spraw;
private Hul re;
Cer(int spraw) {
this.spraw = spraw;
}
public void setRe(Hul re) {
this.re = re;
}
public static void jolbac() {
}
public static void ounCecia(int fis) {
int huc = 19;
}
public void comor(Cer la, int po, Cer cel) {
new Hul(11).upes(cel, po);
}
}
Hints for practicing this puzzle:
Related puzzles: