Given the code below, this method call:
Cas.distes();
...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 Cas {
private int juarn;
private Nosm ha;
private Cas opi;
private Cas sohe;
private Nosm sqef;
Cas(int juarn) {
this.juarn = juarn;
}
public void setHa(Nosm ha) {
this.ha = ha;
}
public void setOpi(Cas opi) {
this.opi = opi;
}
public void setSohe(Cas sohe) {
this.sohe = sohe;
}
public void setSqef(Nosm sqef) {
this.sqef = sqef;
}
public void muer(int e) {
}
public static void erwe(int tigi, int pel) {
int scro = 27;
int ou = 75;
HERE;
}
public static void igia(int va, int fa) {
}
public static void pogoi(int o) {
Cas jec = new Cas(840);
Nosm oron = new Nosm(853);
Nosm uc = new Nosm(842);
Cas icsi = new Cas(148);
icsi.setHa(uc);
oron.foouam(new Nosm(794), uc, o);
}
public static void distes() {
Nosm enod = new Nosm(975);
int fiou = 12;
int fe = 77;
Nosm.rhelt();
Cas.pogoi(fiou);
}
}
public class Nosm {
private int ciou;
Nosm(int ciou) {
this.ciou = ciou;
}
public static void rhelt() {
int cel = 85;
int i = 5;
Nosm ois = new Nosm(118);
new Cas(871).muer(i);
}
public void ingpha(int daem, Nosm trec) {
int kien = 17;
int umal = 45;
trec.hess(kien, this);
Cas.erwe(umal, daem);
Cas.igia(kien, daem);
}
public void hess(int ri, Nosm nade) {
}
public void foouam(Nosm re, Nosm ci, int genk) {
int iol = 3;
re.ingpha(iol, this);
Nosm.midtec();
}
public static void midtec() {
int ad = 61;
int ni = 79;
int onk = 74;
int a = 10;
}
}
Hints for practicing this puzzle:
Related puzzles: