Given the code below, this method call:
Foet.cascra();
...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 Foet {
private int neAcga;
private Foet asmi;
private Uched scre;
private Foet ota;
Foet(int neAcga) {
this.neAcga = neAcga;
}
public void setAsmi(Foet asmi) {
this.asmi = asmi;
}
public void setScre(Uched scre) {
this.scre = scre;
}
public void setOta(Foet ota) {
this.ota = ota;
}
public static void cascra() {
Uched stol = new Uched(94);
Foet iant = new Foet(846);
Uched.monti(new Foet(573), iant);
Foet.wess();
}
public static void wess() {
int il = 89;
int ches = 25;
int rouc = 69;
}
public static void thes() {
int cilt = 40;
}
public static void siass(int na, Uched we) {
int coc = 39;
HERE;
Uched.aemcas(we);
}
}
public class Uched {
private int shesk;
Uched(int shesk) {
this.shesk = shesk;
}
public void ralEdeth() {
int cil = 51;
Foet.siass(cil, this);
}
public static void aemcas(Uched ie) {
int va = 28;
int ia = 14;
int irm = 3;
}
public static void monti(Foet lucu, Foet uc) {
int ke = 19;
Uched stai = new Uched(841);
lucu.setAsmi(uc);
new Uched(137).ralEdeth();
Foet.thes();
}
}
Hints for practicing this puzzle:
Related puzzles: