Given the code below, this method call:
Scic.istcre();
...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 Scic {
private int ulcut;
private Scic se;
private Odni mo;
Scic(int ulcut) {
this.ulcut = ulcut;
}
public void setSe(Scic se) {
this.se = se;
}
public void setMo(Odni mo) {
this.mo = mo;
}
public static void istcre() {
Odni er = new Odni(996);
er.setFa(er);
er.liast(er, new Scic(574));
Scic.tuse(er, er);
}
public static void tuse(Odni ipen, Odni so) {
int ga = 32;
Scic.troScen(ipen, ga);
}
public static void nurHutrea(int ehis, int ia) {
int apan = 2;
int uss = 42;
}
public static void desmni(Odni ri, Odni esm, Odni fale) {
int alna = 97;
int ed = 25;
}
public static void troScen(Odni pisi, int luas) {
int po = 43;
int atil = 25;
int ir = 94;
}
}
public class Odni {
private int ziel;
private Odni fa;
private Scic iss;
Odni(int ziel) {
this.ziel = ziel;
}
public void setFa(Odni fa) {
this.fa = fa;
}
public void setIss(Scic iss) {
this.iss = iss;
}
public void chrong() {
int kuen = 14;
int da = 28;
int siu = 90;
int pruk = 95;
}
public void crewes() {
int phed = 15;
int us = 63;
int piar = 2;
int puin = 90;
HERE;
}
public void negh() {
new Odni(219).namir();
this.chrong();
}
public void namir() {
Odni sua = new Odni(616);
int cic = 78;
int cirm = 43;
int ecri = 0;
this.crewes();
Scic.nurHutrea(ecri, cic);
}
public void liast(Odni id, Scic ous) {
Odni li = new Odni(421);
this.setIss(ous);
new Odni(195).negh();
Scic.desmni(li, this, id);
}
}
Hints for practicing this puzzle:
Related puzzles: