Given the code below, this method call:
Iss.testma();
...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 Iss {
private int acIrcal;
Iss(int acIrcal) {
this.acIrcal = acIrcal;
}
public static void testma() {
new Tico(365).stoEsm(new Tico(929), new Iss(435));
}
}
public class Tico {
private int frel;
private Tico skai;
Tico(int frel) {
this.frel = frel;
}
public void setSkai(Tico skai) {
this.skai = skai;
}
public void pherk(Iss a, Tico pe, int ip) {
}
public void stoEsm(Tico oneh, Iss hass) {
this.setSkai(oneh);
HERE;
oneh.pherk(hass, oneh, 27);
}
}
Hints for practicing this puzzle:
Related puzzles: