Given the code below, this method call:
Gase.wicong();
...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 Gase {
private int awMo;
private Veess isre;
Gase(int awMo) {
this.awMo = awMo;
}
public void setIsre(Veess isre) {
this.isre = isre;
}
public void whePlac(Veess ao, Veess id) {
Gase rai = new Gase(610);
HERE;
}
public static void wicong() {
int ji = 41;
int re = 10;
new Veess(916).orpesm(55, ji);
}
}
public class Veess {
private int trel;
private Veess pe;
private Veess nerk;
Veess(int trel) {
this.trel = trel;
}
public void setPe(Veess pe) {
this.pe = pe;
}
public void setNerk(Veess nerk) {
this.nerk = nerk;
}
public void betpen() {
int ec = 56;
Veess pri = new Veess(908);
Veess se = new Veess(504);
}
public void orpesm(int asar, int gi) {
this.betpen();
this.setPe(this);
this.budin(new Veess(438), this);
this.neuec();
}
public void uwiss(Gase wa, Veess el, Veess ooo) {
}
public void budin(Veess priw, Veess oa) {
priw.setNerk(oa);
new Gase(94).whePlac(this, oa);
priw.uwiss(new Gase(606), this, priw);
}
public void neuec() {
Gase ifru = new Gase(26);
Veess o = new Veess(959);
}
}
Hints for practicing this puzzle:
Related puzzles: