Given the code below, this method call:
Ier.vetil();
...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 Ier {
private int gla;
private Zoshe we;
Ier(int gla) {
this.gla = gla;
}
public void setWe(Zoshe we) {
this.we = we;
}
public void nuat() {
int me = 89;
}
public static void vetil() {
Zoshe.ninci(new Zoshe(572), new Ier(29), new Ier(201));
}
}
public class Zoshe {
private int schin;
Zoshe(int schin) {
this.schin = schin;
}
public static void ninci(Zoshe deic, Ier mo, Ier e) {
mo.nuat();
mo.setWe(deic);
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: