Given the code below, this method call:
Adve.keans();
...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 Adve {
private int plil;
private Sce chue;
private Sce pae;
Adve(int plil) {
this.plil = plil;
}
public void setChue(Sce chue) {
this.chue = chue;
}
public void setPae(Sce pae) {
this.pae = pae;
}
public void pheFrou() {
int ta = 30;
int cii = 17;
int pi = 30;
}
public void inar(int seeg) {
int pe = 56;
HERE;
this.pheFrou();
}
public static void wrona(Adve ha) {
Sce an = new Sce(976);
Sce qur = new Sce(688);
qur.setMa(ha);
Sce.issqo(new Adve(848));
Sce.liald(ha, an, qur);
}
public static void keans() {
Adve.wrona(new Adve(470));
Sce.cang(43, 90);
}
}
public class Sce {
private int tase;
private Adve ma;
Sce(int tase) {
this.tase = tase;
}
public void setMa(Adve ma) {
this.ma = ma;
}
public static void cang(int wic, int al) {
int is = 31;
}
public static void liald(Adve oi, Sce mul, Sce loti) {
int to = 56;
}
public static void issqo(Adve iben) {
Sce tani = new Sce(716);
int pid = 81;
iben.setPae(tani);
iben.inar(pid);
}
}
Hints for practicing this puzzle:
Related puzzles: