Given the code below, this method call:
Sonla.cened();
...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 Sonla {
private int ciar;
private Sonla hi;
Sonla(int ciar) {
this.ciar = ciar;
}
public void setHi(Sonla hi) {
this.hi = hi;
}
public void teshi(Berga nint, Sonla vi) {
Berga riac = new Berga(822);
nint.cescar(this, riac, new Berga(903));
}
public static void aciCrosol(int noc) {
Berga.egrir(noc, new Berga(867));
}
public static void haklax(Berga cii) {
int ed = 97;
int mo = 17;
int clol = 91;
Berga nesm = new Berga(50);
HERE;
cii.mangeo();
}
public static void cened() {
Berga oche = new Berga(182);
new Sonla(483).teshi(oche, new Sonla(819));
oche.setFi(oche);
Berga.blodo(new Berga(441), oche);
}
public void casMinan(Berga il, Sonla ke) {
}
}
public class Berga {
private int irTu;
private Berga fi;
private Sonla un;
private Berga asm;
Berga(int irTu) {
this.irTu = irTu;
}
public void setFi(Berga fi) {
this.fi = fi;
}
public void setUn(Sonla un) {
this.un = un;
}
public void setAsm(Berga asm) {
this.asm = asm;
}
public static void kocCilra(Berga pou, Berga uten) {
int dasm = 33;
int kiid = 69;
int shio = 8;
}
public static void blodo(Berga ma, Berga cu) {
Berga of = new Berga(279);
int aish = 94;
int o = 10;
ma.setAsm(of);
Sonla.aciCrosol(o);
Berga.kocCilra(ma, cu);
}
public void cescar(Sonla eu, Berga co, Berga id) {
int u = 11;
}
public static void egrir(int raqe, Berga e) {
Sonla pa = new Sonla(875);
pa.casMinan(e, new Sonla(306));
e.setAsm(e);
Sonla.haklax(e);
}
public void mangeo() {
int crie = 81;
int viel = 18;
int eal = 60;
int vaem = 66;
}
}
Hints for practicing this puzzle:
Related puzzles: