Given the code below, this method call:
Geis.harnec();
...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 Geis {
private int oass;
private Roro on;
Geis(int oass) {
this.oass = oass;
}
public void setOn(Roro on) {
this.on = on;
}
public static void harnec() {
Roro el = new Roro(992);
int od = 0;
new Roro(727).errad();
el.setGa(el);
new Geis(225).pinil(new Roro(683), 87);
}
public void pinil(Roro de, int ad) {
this.setOn(de);
de.skemi(ad);
de.proil(de, new Roro(407), ad);
}
}
public class Roro {
private int rer;
private Roro ic;
private Roro ga;
Roro(int rer) {
this.rer = rer;
}
public void setIc(Roro ic) {
this.ic = ic;
}
public void setGa(Roro ga) {
this.ga = ga;
}
public void errad() {
int auck = 84;
int loet = 94;
int rast = 18;
}
public static void ogaStiu(int di, int il) {
int nas = 65;
Roro sose = new Roro(865);
}
public void proil(Roro as, Roro er, int be) {
}
public void dalen(int dac, Roro ri, int hac) {
Roro.ogaStiu(dac, hac);
HERE;
}
public void skemi(int khoe) {
int ial = 38;
Roro na = new Roro(49);
this.dalen(ial, na, 40);
}
}
Hints for practicing this puzzle:
Related puzzles: