Given the code below, this method call:
Ses.ienOcrul();
...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 Ses {
private int hasca;
private Leind ge;
Ses(int hasca) {
this.hasca = hasca;
}
public void setGe(Leind ge) {
this.ge = ge;
}
public void pecAng(Leind asax, int wa) {
}
public static void ienOcrul() {
int ed = 65;
new Leind(830).criat(ed, new Ses(733), new Ses(58));
}
}
public class Leind {
private int ioGa;
Leind(int ioGa) {
this.ioGa = ioGa;
}
public void criat(int deci, Ses snon, Ses pai) {
pai.setGe(this);
HERE;
pai.pecAng(this, 80);
}
}
Hints for practicing this puzzle:
Related puzzles: