Given the code below, this method call:
Plel.duri();
...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 Plel {
private int adRilmi;
private Asm ca;
Plel(int adRilmi) {
this.adRilmi = adRilmi;
}
public void setCa(Asm ca) {
this.ca = ca;
}
public static void duri() {
Asm e = new Asm(916);
int vi = 91;
Plel si = new Plel(707);
Plel pe = new Plel(488);
Plel soec = new Plel(998);
si.setCa(e);
soec.cispel(si, 84);
Plel.rhusuc(pe);
}
public void varpec(int xac, Plel claa) {
int fi = 85;
}
public static void rhusuc(Plel hect) {
Asm.paolva();
}
public void cispel(Plel ce, int ic) {
Asm.troCeddid();
this.freVeou(ce);
}
public void pricaw() {
int a = 20;
int qush = 99;
this.varpec(a, this);
Asm.ungco(qush);
}
public void freVeou(Plel ici) {
int ebin = 1;
int fos = 34;
}
}
public class Asm {
private int ashsu;
private Asm nu;
private Plel sa;
private Plel cas;
Asm(int ashsu) {
this.ashsu = ashsu;
}
public void setNu(Asm nu) {
this.nu = nu;
}
public void setSa(Plel sa) {
this.sa = sa;
}
public void setCas(Plel cas) {
this.cas = cas;
}
public static void paolva() {
int go = 55;
int mirm = 88;
}
public void harSas() {
int nofa = 10;
int di = 51;
int ciil = 11;
int spia = 85;
}
public static void troCeddid() {
int hu = 48;
Plel nai = new Plel(667);
Asm u = new Asm(556);
int po = 4;
u.harSas();
u.setSa(nai);
nai.pricaw();
}
public static void ungco(int en) {
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: