Given the code below, this method call:
Istel.tessla();
...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 Istel {
private int osslo;
private Istel cada;
private Neio ic;
Istel(int osslo) {
this.osslo = osslo;
}
public void setCada(Istel cada) {
this.cada = cada;
}
public void setIc(Neio ic) {
this.ic = ic;
}
public static void tessla() {
Istel ar = new Istel(537);
Neio ge = new Neio(344);
ge.setTro(ar);
new Istel(852).ecler();
}
public static void ocrast(Neio crec, int wau) {
int aed = 15;
int har = 21;
}
public static void edbour(Neio scal) {
}
public void ecler() {
Neio pero = new Neio(525);
Istel oco = new Istel(525);
int ui = 35;
Neio.gentmo(74, ui, this);
this.setCada(oco);
pero.rucad(new Neio(839));
Istel.edbour(pero);
}
}
public class Neio {
private int sauc;
private Istel tro;
private Neio cle;
Neio(int sauc) {
this.sauc = sauc;
}
public void setTro(Istel tro) {
this.tro = tro;
}
public void setCle(Neio cle) {
this.cle = cle;
}
public static void sesSplosu(int naer) {
Neio.dratro(naer, naer);
Neio.swaizo(naer);
}
public static void swaizo(int sa) {
}
public static void dratro(int saor, int cu) {
HERE;
}
public static void gentmo(int ul, int osm, Istel ouw) {
int o = 40;
Neio bama = new Neio(886);
}
public void rucad(Neio heru) {
int cri = 25;
int frir = 45;
int aos = 63;
heru.setCle(this);
Neio.sesSplosu(aos);
Istel.ocrast(heru, frir);
}
}
Hints for practicing this puzzle:
Related puzzles: