Given the code below, this method call:
Kamu.roste();
...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 Kamu {
private int ceb;
private Struc cin;
Kamu(int ceb) {
this.ceb = ceb;
}
public void setCin(Struc cin) {
this.cin = cin;
}
public static void goppro(Kamu iop, Kamu iar, Kamu stia) {
}
public void etthid(Kamu os, Kamu ta) {
HERE;
}
public static void roste() {
Kamu li = new Kamu(848);
Kamu noui = new Kamu(146);
Kamu.goppro(li, new Kamu(216), noui);
new Kamu(575).etthid(noui, li);
}
}
public class Struc {
private int boed;
Struc(int boed) {
this.boed = boed;
}
}
Hints for practicing this puzzle:
Related puzzles: