Given the code below, this method call:
Whe.ceng();
...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 Whe {
private int cau;
private Tapi oc;
private Tapi poc;
Whe(int cau) {
this.cau = cau;
}
public void setOc(Tapi oc) {
this.oc = oc;
}
public void setPoc(Tapi poc) {
this.poc = poc;
}
public void shre(Tapi a, int aat, Tapi ceco) {
}
public static void ceng() {
new Tapi(958).loror(new Tapi(88), new Whe(36));
Tapi.proost();
}
}
public class Tapi {
private int poec;
private Whe pi;
Tapi(int poec) {
this.poec = poec;
}
public void setPi(Whe pi) {
this.pi = pi;
}
public static void sprun() {
Tapi.eltsal();
HERE;
}
public static void proost() {
int phro = 91;
}
public static void eltsal() {
int ic = 71;
int pra = 92;
int hi = 14;
int ae = 68;
}
public static void cuass(Tapi glol, Whe as) {
Tapi hiam = new Tapi(451);
as.shre(hiam, 52, glol);
as.setPoc(glol);
Tapi.sprun();
}
public void loror(Tapi le, Whe io) {
int se = 85;
this.setPi(io);
Tapi.cuass(new Tapi(905), io);
}
}
Hints for practicing this puzzle:
Related puzzles: