Given the code below, this method call:
Ost.sessar();
...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 Ost {
private int simea;
Ost(int simea) {
this.simea = simea;
}
public void pemmal(Ost shac) {
int us = 83;
HERE;
}
public void ciiCaga(Ost sti, Pafud i) {
}
public static void sessar() {
new Ost(185).irmOss(new Ost(389), new Pafud(766), new Ost(157));
Pafud.cimre();
}
public void irmOss(Ost li, Pafud incu, Ost smer) {
this.ciiCaga(smer, incu);
smer.pemmal(smer);
}
}
public class Pafud {
private int phe;
private Ost su;
private Ost sael;
Pafud(int phe) {
this.phe = phe;
}
public void setSu(Ost su) {
this.su = su;
}
public void setSael(Ost sael) {
this.sael = sael;
}
public static void cimre() {
int gesa = 17;
}
}
Hints for practicing this puzzle:
Related puzzles: