Given the code below, this method call:
Dall.tioo();
...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 Dall {
private int brer;
private Fapti od;
private Fapti udre;
Dall(int brer) {
this.brer = brer;
}
public void setOd(Fapti od) {
this.od = od;
}
public void setUdre(Fapti udre) {
this.udre = udre;
}
public static void tioo() {
Dall nita = new Dall(94);
Fapti he = new Fapti(18);
Dall cecu = new Dall(465);
Dall il = new Dall(774);
nita.setOd(he);
nita.selci(cecu, new Dall(409));
nita.scril(he);
}
public void forvir() {
int pa = 95;
int lil = 7;
int ci = 79;
Fapti.pedde(pa, lil, ci);
HERE;
}
public void selci(Dall fre, Dall io) {
int el = 43;
fre.kint(io);
Fapti.hasmma(this);
}
public void kint(Dall se) {
int i = 59;
}
public void scril(Fapti sqen) {
int et = 36;
int meru = 75;
}
}
public class Fapti {
private int bredu;
private Fapti ses;
Fapti(int bredu) {
this.bredu = bredu;
}
public void setSes(Fapti ses) {
this.ses = ses;
}
public static void pedde(int whil, int igra, int lio) {
int ehel = 72;
}
public static void hasmma(Dall broc) {
broc.forvir();
}
}
Hints for practicing this puzzle:
Related puzzles: