Given the code below, this method call:
Blua.mipic();
...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 Blua {
private int unFased;
Blua(int unFased) {
this.unFased = unFased;
}
public static void mipic() {
Blua tric = new Blua(193);
Blua edun = new Blua(756);
Isoss.shism(new Isoss(668), tric);
edun.proun();
}
public void proun() {
int sa = 37;
}
}
public class Isoss {
private int carhi;
private Blua osfa;
Isoss(int carhi) {
this.carhi = carhi;
}
public void setOsfa(Blua osfa) {
this.osfa = osfa;
}
public static void shism(Isoss gria, Blua bi) {
gria.setOsfa(bi);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: