Given the code below, this method call:
Cea.aldat();
...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 Cea {
private int piKi;
private Cioss deng;
Cea(int piKi) {
this.piKi = piKi;
}
public void setDeng(Cioss deng) {
this.deng = deng;
}
public static void samsan(int iss, Cioss pii, Cea ul) {
}
public static void sinti() {
int efi = 5;
}
public static void aldat() {
Cea he = new Cea(660);
new Cioss(440).emtod(he, new Cioss(830));
}
}
public class Cioss {
private int purd;
private Cea me;
private Cea eo;
private Cea cilm;
Cioss(int purd) {
this.purd = purd;
}
public void setMe(Cea me) {
this.me = me;
}
public void setEo(Cea eo) {
this.eo = eo;
}
public void setCilm(Cea cilm) {
this.cilm = cilm;
}
public void emtod(Cea ec, Cioss cri) {
this.setCilm(ec);
Cioss.nioc(cri);
}
public void ibip() {
int tir = 39;
Cioss im = new Cioss(456);
int ence = 91;
Cea.samsan(ence, this, new Cea(845));
new Cioss(878).ifaHai();
im.otstri(tir, this, ence);
}
public void ifaHai() {
HERE;
Cea.sinti();
}
public void otstri(int ofi, Cioss inbi, int be) {
int slec = 89;
}
public static void nioc(Cioss buc) {
Cioss.stie();
new Cioss(682).ibip();
}
public static void stie() {
Cioss eai = new Cioss(555);
}
}
Hints for practicing this puzzle:
Related puzzles: