Given the code below, this method call:
Sloi.clac();
...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 Sloi {
private int scew;
private Sloi an;
Sloi(int scew) {
this.scew = scew;
}
public void setAn(Sloi an) {
this.an = an;
}
public static void usmDiiasm(Sloi ic, Sloi id) {
id.setAn(ic);
HERE;
}
public static void clac() {
Tadid.asmbu(new Sloi(290));
Sloi.usmDiiasm(new Sloi(198), new Sloi(7));
}
}
public class Tadid {
private int ciu;
Tadid(int ciu) {
this.ciu = ciu;
}
public static void asmbu(Sloi lio) {
int ua = 40;
}
}
Hints for practicing this puzzle:
Related puzzles: