Given the code below, this method call:
Cesso.ilunt();
...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 Cesso {
private int pruss;
private Bron otoo;
private Bron stro;
Cesso(int pruss) {
this.pruss = pruss;
}
public void setOtoo(Bron otoo) {
this.otoo = otoo;
}
public void setStro(Bron stro) {
this.stro = stro;
}
public static void ungo(Bron isse) {
Bron zom = new Bron(258);
}
public static void soldoc(int maso, int sesm) {
int ou = 32;
int ru = 42;
int kes = 1;
}
public void hoiplo(Bron uma, int buca) {
int ui = 51;
new Bron(857).priosm();
this.setOtoo(uma);
new Bron(477).strer();
}
public static void ilunt() {
int iac = 4;
Bron bic = new Bron(385);
bic.laeAont(bic);
bic.setEsti(bic);
Cesso.wicDesa(new Cesso(584), iac);
}
public static void wicDesa(Cesso proh, int rard) {
Bron wam = new Bron(735);
proh.setOtoo(wam);
new Cesso(482).hoiplo(wam, rard);
}
public static void uent() {
Cesso og = new Cesso(258);
int eid = 27;
int uss = 61;
int ge = 11;
HERE;
Cesso.soldoc(ge, uss);
}
}
public class Bron {
private int feron;
private Cesso ang;
private Bron esti;
Bron(int feron) {
this.feron = feron;
}
public void setAng(Cesso ang) {
this.ang = ang;
}
public void setEsti(Bron esti) {
this.esti = esti;
}
public void priosm() {
Cesso oji = new Cesso(566);
}
public void strer() {
int piud = 33;
Cesso.uent();
Bron.hamis(this);
}
public static void hamis(Bron ias) {
int tru = 62;
int fonk = 75;
int kani = 31;
}
public void laeAont(Bron lued) {
int sa = 44;
Cesso.ungo(this);
}
}
Hints for practicing this puzzle:
Related puzzles: