Given the code below, this method call:
Stit.cacum();
...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 Stit {
private int uss;
private Stit ent;
private Desar od;
private Desar er;
Stit(int uss) {
this.uss = uss;
}
public void setEnt(Stit ent) {
this.ent = ent;
}
public void setOd(Desar od) {
this.od = od;
}
public void setEr(Desar er) {
this.er = er;
}
public static void cacum() {
Desar na = new Desar(566);
int ang = 62;
Stit hedu = new Stit(824);
Stit ga = new Stit(881);
Desar moum = new Desar(304);
na.harch(ang);
moum.setCil(hedu);
new Desar(847).spia(moum, na, hedu);
}
public static void ebuResoc(int ou, int en) {
int gace = 36;
int ce = 10;
}
public void nebuss() {
Stit opo = new Stit(546);
Stit ow = new Stit(969);
int ha = 56;
}
public static void ebaSeng() {
int uldi = 16;
int ve = 84;
int ta = 70;
int un = 28;
int eu = 0;
Desar.taso(eu, ve);
Stit.ebuResoc(un, eu);
}
}
public class Desar {
private int oput;
private Stit cil;
Desar(int oput) {
this.oput = oput;
}
public void setCil(Stit cil) {
this.cil = cil;
}
public void darbon(Desar nen, Desar ec) {
}
public void harch(int da) {
Stit ji = new Stit(234);
Stit cuso = new Stit(170);
Stit se = new Stit(925);
se.nebuss();
}
public void ciod() {
}
public void flene(Desar de) {
int an = 2;
int a = 88;
int ip = 4;
de.darbon(de, this);
Stit.ebaSeng();
this.ciod();
}
public static void taso(int mio, int be) {
HERE;
}
public void spia(Desar adbi, Desar fu, Stit u) {
adbi.setCil(u);
new Desar(458).flene(this);
}
}
Hints for practicing this puzzle:
Related puzzles: