Given the code below, this method call:
Tesde.nicil();
...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 Tesde {
private int suni;
private Hiron pra;
private Hiron ki;
Tesde(int suni) {
this.suni = suni;
}
public void setPra(Hiron pra) {
this.pra = pra;
}
public void setKi(Hiron ki) {
this.ki = ki;
}
public void twox(Tesde sti, int tul) {
int woc = 3;
int swut = 13;
HERE;
this.dast(this, sti, tul);
}
public void dast(Tesde ouma, Tesde er, int iti) {
int ad = 72;
}
public void radca() {
int zul = 99;
int qi = 19;
int ix = 84;
this.twox(this, zul);
this.erel(this, 86, zul);
}
public static void nicil() {
int om = 10;
Tesde pauo = new Tesde(16);
Hiron pric = new Hiron(63);
Tesde la = new Tesde(3);
Hiron lec = new Hiron(616);
pauo.setPra(lec);
Hiron.duaRiusm(pauo);
}
public void plard(Tesde daid) {
Tesde ce = new Tesde(112);
int fres = 42;
this.radca();
Tesde.stoid();
}
public static void stoid() {
}
public void erel(Tesde gi, int gred, int crua) {
}
}
public class Hiron {
private int huc;
private Hiron sas;
private Hiron le;
Hiron(int huc) {
this.huc = huc;
}
public void setSas(Hiron sas) {
this.sas = sas;
}
public void setLe(Hiron le) {
this.le = le;
}
public static void nasic() {
Hiron scen = new Hiron(847);
}
public static void duaRiusm(Tesde pio) {
Hiron.nasic();
new Tesde(962).plard(pio);
}
}
Hints for practicing this puzzle:
Related puzzles: