Given the code below, this method call:
Essic.ridne();
...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 Essic {
private int udto;
private Kria prer;
Essic(int udto) {
this.udto = udto;
}
public void setPrer(Kria prer) {
this.prer = prer;
}
public static void trude(Essic ar) {
int ci = 59;
Essic ea = new Essic(877);
int bla = 35;
Essic.cepro();
new Essic(474).rhang(ea, ci, ar);
}
public static void untCed(Kria idei, int isoc) {
int icpe = 99;
Kria ad = new Kria(455);
Kria bume = new Kria(636);
}
public void pleMees() {
int vo = 59;
Essic.trude(this);
Essic.untCed(new Kria(564), vo);
}
public static void cepro() {
int onpa = 64;
Essic bre = new Essic(670);
}
public static void prehon() {
Kria sest = new Kria(86);
Kria iss = new Kria(660);
Essic oalt = new Essic(829);
Essic ista = new Essic(663);
new Kria(690).clepa(0, sest);
}
public static void ridne() {
new Essic(329).pleMees();
Essic.prehon();
}
public void rhang(Essic oxdu, int imen, Essic lehe) {
new Kria(800).hobar(this);
}
}
public class Kria {
private int henod;
private Essic ro;
private Kria nur;
private Essic gost;
Kria(int henod) {
this.henod = henod;
}
public void setRo(Essic ro) {
this.ro = ro;
}
public void setNur(Kria nur) {
this.nur = nur;
}
public void setGost(Essic gost) {
this.gost = gost;
}
public void clepa(int ste, Kria elac) {
Kria bi = new Kria(681);
}
public void hobar(Essic dros) {
int sphi = 38;
Essic so = new Essic(117);
this.ihorm(dros, 77);
so.setPrer(this);
HERE;
}
public void ihorm(Essic cus, int thre) {
int diad = 5;
int mo = 39;
}
}
Hints for practicing this puzzle:
Related puzzles: