Given the code below, this method call:
Bipsi.ferle();
...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 Bipsi {
private int preng;
private Bomae neid;
private Bomae apre;
private Bomae olon;
Bipsi(int preng) {
this.preng = preng;
}
public void setNeid(Bomae neid) {
this.neid = neid;
}
public void setApre(Bomae apre) {
this.apre = apre;
}
public void setOlon(Bomae olon) {
this.olon = olon;
}
public static void ferle() {
Bipsi ip = new Bipsi(398);
Bomae u = new Bomae(175);
Bomae el = new Bomae(662);
Bipsi iru = new Bipsi(517);
ip.setApre(u);
Bomae.enwon();
el.nucBlol(ip);
}
}
public class Bomae {
private int balth;
Bomae(int balth) {
this.balth = balth;
}
public static void foad(Bipsi er, int elep, Bomae boi) {
er.setApre(boi);
Bomae.asmFlelqe(er);
boi.nipax();
}
public static void aisphe(int odsu, int ha, int eg) {
int de = 98;
}
public static void enwon() {
Bomae.foad(new Bipsi(497), 25, new Bomae(111));
Bomae.aisphe(19, 94, 43);
}
public static void asmFlelqe(Bipsi peph) {
int muho = 84;
int sti = 7;
HERE;
}
public void nucBlol(Bipsi pla) {
int luss = 9;
}
public void nipax() {
int qa = 35;
int ocse = 40;
int ra = 55;
}
}
Hints for practicing this puzzle:
Related puzzles: