Given the code below, this method call:
Rhil.prari();
...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 Rhil {
private int cri;
private Pel he;
Rhil(int cri) {
this.cri = cri;
}
public void setHe(Pel he) {
this.he = he;
}
public static void keunt(int ro, int thra) {
int os = 3;
}
public static void vink(Rhil ce, Rhil apre, int in) {
int awi = 58;
}
public static void spefu() {
int se = 17;
HERE;
Pel.steas(se, se);
}
public static void prari() {
int ict = 49;
Rhil beac = new Rhil(335);
int en = 56;
new Pel(597).toceng(new Pel(18), ict, beac);
beac.sormqe(en, ict, beac);
}
public static void stas() {
Rhil phad = new Rhil(928);
Rhil da = new Rhil(604);
Pel spro = new Pel(710);
int im = 36;
int spi = 40;
spro.bieBrec(da, im);
da.setHe(spro);
Rhil.spefu();
}
public void sormqe(int riee, int wouo, Rhil ecdo) {
Rhil.vink(this, ecdo, riee);
}
}
public class Pel {
private int riang;
private Rhil reac;
private Rhil scic;
private Rhil segh;
Pel(int riang) {
this.riang = riang;
}
public void setReac(Rhil reac) {
this.reac = reac;
}
public void setScic(Rhil scic) {
this.scic = scic;
}
public void setSegh(Rhil segh) {
this.segh = segh;
}
public void toceng(Pel gom, int wa, Rhil es) {
es.setHe(this);
Pel.soas();
}
public static void steas(int me, int an) {
int lo = 82;
int duss = 70;
int ha = 20;
}
public void bieBrec(Rhil aia, int el) {
int ci = 67;
}
public static void soas() {
int u = 99;
Rhil.stas();
Rhil.keunt(u, u);
}
}
Hints for practicing this puzzle:
Related puzzles: