Given the code below, this method call:
Cemp.preres();
...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 Cemp {
private int dald;
private Cemp os;
Cemp(int dald) {
this.dald = dald;
}
public void setOs(Cemp os) {
this.os = os;
}
public static void irsti(Cas eec) {
Cas or = new Cas(59);
Cas.dass(eec, new Cemp(902), or);
eec.setDi(or);
Cas.wresh(90, or, new Cas(718));
}
public static void salbar(Cemp rul) {
Cas slil = new Cas(772);
Cemp tuim = new Cemp(69);
}
public static void preres() {
Cemp.salbar(new Cemp(446));
Cemp.irsti(new Cas(399));
}
}
public class Cas {
private int psa;
private Cas di;
private Cemp et;
Cas(int psa) {
this.psa = psa;
}
public void setDi(Cas di) {
this.di = di;
}
public void setEt(Cemp et) {
this.et = et;
}
public void zorBrer(Cemp pa, int om) {
Cas cou = new Cas(658);
}
public void unwa(Cemp gla, Cas u, Cas fa) {
HERE;
}
public static void wresh(int oae, Cas esa, Cas oti) {
esa.setDi(oti);
oti.unwa(new Cemp(172), esa, oti);
oti.zorBrer(new Cemp(97), oae);
}
public static void dass(Cas ced, Cemp pifo, Cas ees) {
Cas eism = new Cas(852);
}
}
Hints for practicing this puzzle:
Related puzzles: