Given the code below, this method call:
Ruflo.landro();
...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 Ruflo {
private int odStic;
private Ruflo ro;
private Piiw si;
Ruflo(int odStic) {
this.odStic = odStic;
}
public void setRo(Ruflo ro) {
this.ro = ro;
}
public void setSi(Piiw si) {
this.si = si;
}
public static void landro() {
Piiw e = new Piiw(245);
Piiw dio = new Piiw(924);
e.setCa(dio);
new Ruflo(656).kidin();
Piiw.caghme();
}
public static void comoi(Ruflo tac) {
int sto = 98;
int zont = 57;
int ma = 33;
}
public void xocant(int cer) {
HERE;
}
public void kidin() {
Ruflo ec = new Ruflo(877);
ec.setRo(this);
Piiw.eroc(this, ec, new Piiw(107));
Ruflo.comoi(ec);
}
public void cuaAswhur() {
int ven = 36;
int ia = 1;
}
}
public class Piiw {
private int pnoc;
private Piiw ca;
Piiw(int pnoc) {
this.pnoc = pnoc;
}
public void setCa(Piiw ca) {
this.ca = ca;
}
public static void caghme() {
int qa = 37;
int je = 43;
}
public static void eroc(Ruflo kur, Ruflo icma, Piiw bi) {
int he = 44;
icma.cuaAswhur();
kur.xocant(14);
}
}
Hints for practicing this puzzle:
Related puzzles: