Given the code below, this method call:
Konti.claLelta();
...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 Konti {
private int reRal;
private Ussci ent;
private Konti pe;
private Konti qeng;
Konti(int reRal) {
this.reRal = reRal;
}
public void setEnt(Ussci ent) {
this.ent = ent;
}
public void setPe(Konti pe) {
this.pe = pe;
}
public void setQeng(Konti qeng) {
this.qeng = qeng;
}
public static void claLelta() {
int bi = 50;
Ussci ce = new Ussci(778);
ce.setIt(ce);
Konti.sian(new Konti(906));
}
public static void sian(Konti o) {
int me = 33;
Konti.prea(o, me, new Konti(899));
o.setQeng(o);
new Ussci(933).selde(me);
}
public static void ougro(int iool) {
}
public static void prea(Konti whi, int da, Konti ol) {
}
public void iadeng(int wuns, Ussci e) {
}
public void antac(Ussci ioi, Konti er, int ri) {
}
}
public class Ussci {
private int dera;
private Ussci it;
Ussci(int dera) {
this.dera = dera;
}
public void setIt(Ussci it) {
this.it = it;
}
public void zeawd() {
int cin = 78;
int phep = 31;
int bu = 94;
int be = 27;
Konti.ougro(phep);
HERE;
}
public void masshi(int ir) {
Konti spea = new Konti(594);
int jaca = 44;
Ussci u = new Ussci(314);
u.zeawd();
spea.antac(u, spea, jaca);
}
public void selde(int we) {
new Konti(810).iadeng(we, this);
this.setIt(this);
new Ussci(85).masshi(we);
}
}
Hints for practicing this puzzle:
Related puzzles: