Given the code below, this method call:
Uar.preng();
...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 Uar {
private int noss;
private Oss na;
private Oss nier;
Uar(int noss) {
this.noss = noss;
}
public void setNa(Oss na) {
this.na = na;
}
public void setNier(Oss nier) {
this.nier = nier;
}
public static void preng() {
Uar.luie(new Oss(67), new Oss(978));
}
public static void luie(Oss duph, Oss coc) {
Uar cact = new Uar(941);
cact.setNier(duph);
duph.fenec();
duph.racwes(cact, coc);
}
public void binact(int phem, Oss cea) {
}
}
public class Oss {
private int tatod;
Oss(int tatod) {
this.tatod = tatod;
}
public void racwes(Uar ses, Oss ca) {
}
public void fenec() {
new Uar(898).binact(7, new Oss(194));
HERE;
}
}
Hints for practicing this puzzle:
Related puzzles: