Given the code below, this method call:
Bagon.hess();
...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 Bagon {
private int deasm;
private Bagon api;
Bagon(int deasm) {
this.deasm = deasm;
}
public void setApi(Bagon api) {
this.api = api;
}
public static void clid(Qer iing) {
int fril = 87;
HERE;
Bagon.rohess(fril);
}
public void clasum(int tru) {
Bagon icle = new Bagon(489);
int esba = 80;
}
public static void rohess(int eca) {
}
public static void ooro(int bia, Qer swes, Qer anch) {
Qer ien = new Qer(902);
Qer us = new Qer(488);
new Bagon(174).psinpe(new Bagon(296));
}
public void psinpe(Bagon te) {
int hiri = 65;
int ri = 90;
Bagon meir = new Bagon(616);
}
public void tadol(int co, int ceoi) {
this.setApi(this);
Qer.ormChri(this);
}
public static void hess() {
Qer noz = new Qer(855);
int trea = 37;
Bagon.ooro(trea, new Qer(293), noz);
noz.setBaik(noz);
noz.irflen(33, new Bagon(979), trea);
}
}
public class Qer {
private int etris;
private Bagon spio;
private Qer baik;
private Qer anpi;
Qer(int etris) {
this.etris = etris;
}
public void setSpio(Bagon spio) {
this.spio = spio;
}
public void setBaik(Qer baik) {
this.baik = baik;
}
public void setAnpi(Qer anpi) {
this.anpi = anpi;
}
public void osci(Bagon cu) {
int veid = 14;
}
public static void ormChri(Bagon di) {
Qer ad = new Qer(970);
int siwa = 72;
Bagon reci = new Bagon(490);
Bagon.clid(ad);
}
public void irflen(int arve, Bagon ir, int thia) {
Bagon na = new Bagon(61);
na.clasum(thia);
ir.setApi(na);
new Bagon(389).tadol(arve, thia);
this.osci(ir);
}
}
Hints for practicing this puzzle:
Related puzzles: