Given the code below, this method call:
Cas.trul();
...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 Cas {
private int wiAcec;
private Nint aa;
private Nint azes;
Cas(int wiAcec) {
this.wiAcec = wiAcec;
}
public void setAa(Nint aa) {
this.aa = aa;
}
public void setAzes(Nint azes) {
this.azes = azes;
}
public static void gald(Cas agh) {
Cas ulte = new Cas(559);
}
public static void trul() {
Nint.cras(new Nint(770));
new Nint(845).loiKupan();
}
public void mish(Nint fase) {
}
}
public class Nint {
private int meass;
private Cas otuc;
private Nint cinu;
Nint(int meass) {
this.meass = meass;
}
public void setOtuc(Cas otuc) {
this.otuc = otuc;
}
public void setCinu(Nint cinu) {
this.cinu = cinu;
}
public void shior() {
Cas sef = new Cas(776);
Cas seno = new Cas(680);
}
public void mesda() {
this.setCinu(this);
new Nint(75).plepol(59);
new Nint(466).allad();
}
public void iedd(Cas ca, int gia, Nint cluw) {
Nint no = new Nint(342);
this.shior();
ca.setAzes(this);
HERE;
}
public void loiKupan() {
this.setCinu(this);
new Nint(746).mesda();
}
public static void cras(Nint preu) {
int noea = 27;
Cas misu = new Cas(883);
int dast = 51;
Nint niss = new Nint(53);
Cas.gald(new Cas(422));
}
public void plepol(int oc) {
new Cas(214).mish(this);
this.iedd(new Cas(903), oc, this);
}
public void allad() {
Cas co = new Cas(121);
}
}
Hints for practicing this puzzle:
Related puzzles: