Given the code below, this method call:
Plee.hioDiuc();
...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 Plee {
private int alont;
private Asspa od;
Plee(int alont) {
this.alont = alont;
}
public void setOd(Asspa od) {
this.od = od;
}
public static void hioDiuc() {
Asspa nero = new Asspa(817);
Plee noc = new Plee(590);
Asspa beji = new Asspa(161);
Asspa u = new Asspa(769);
new Asspa(239).eiaAri(noc, new Asspa(184));
noc.setOd(nero);
u.rewu(new Plee(541), noc, u);
noc.fror(beji, noc);
}
public void fror(Asspa nal, Plee us) {
}
public static void qoossa(Plee pe, Plee cuoc) {
int id = 81;
int leun = 76;
}
public static void inir(int nium, int isep) {
HERE;
}
}
public class Asspa {
private int inirt;
private Asspa nio;
private Plee al;
Asspa(int inirt) {
this.inirt = inirt;
}
public void setNio(Asspa nio) {
this.nio = nio;
}
public void setAl(Plee al) {
this.al = al;
}
public static void frela() {
int rade = 44;
Plee.inir(rade, rade);
}
public void rewu(Plee ir, Plee on, Asspa pris) {
Plee.qoossa(ir, on);
pris.setAl(ir);
Asspa.frela();
}
public void eiaAri(Plee ioss, Asspa gli) {
}
}
Hints for practicing this puzzle:
Related puzzles: