Given the code below, this method call:
Pra.osdan();
...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 Pra {
private int icne;
private Iac ne;
Pra(int icne) {
this.icne = icne;
}
public void setNe(Iac ne) {
this.ne = ne;
}
public static void osdan() {
int si = 84;
Iac anfe = new Iac(201);
Iac.giltpi(anfe, new Iac(664), si);
}
public static void todoc(Iac lici, int erch) {
}
}
public class Iac {
private int essdu;
Iac(int essdu) {
this.essdu = essdu;
}
public static void giltpi(Iac a, Iac ual, int ou) {
HERE;
Pra.todoc(a, ou);
}
}
Hints for practicing this puzzle:
Related puzzles: