Given the code below, this method call:
Imel.plek();
...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 Imel {
private int voDrole;
private Imel wras;
private Ohdor orgi;
Imel(int voDrole) {
this.voDrole = voDrole;
}
public void setWras(Imel wras) {
this.wras = wras;
}
public void setOrgi(Ohdor orgi) {
this.orgi = orgi;
}
public static void iadsa() {
int huin = 22;
}
public static void uoss(Ohdor he, int en, int pi) {
int tomo = 60;
}
public static void plek() {
Ohdor de = new Ohdor(537);
int am = 2;
Ohdor ro = new Ohdor(726);
int helo = 60;
de.cisspo();
}
}
public class Ohdor {
private int dedes;
private Imel eism;
Ohdor(int dedes) {
this.dedes = dedes;
}
public void setEism(Imel eism) {
this.eism = eism;
}
public void sormro(Ohdor ang, int ud, Ohdor mie) {
}
public void chec(int ocen, int te) {
HERE;
Imel.uoss(this, ocen, te);
}
public void cisspo() {
Imel oo = new Imel(826);
this.setEism(oo);
new Ohdor(88).niseg(new Ohdor(758));
}
public void niseg(Ohdor bu) {
int ciam = 12;
int u = 78;
this.sormro(bu, ciam, this);
this.chec(u, ciam);
Imel.iadsa();
}
}
Hints for practicing this puzzle:
Related puzzles: