Note: If some answer does not make sense, or it's not well explained I apologise, please leave a question in the gist.
-
Q2a: Answer -> 4
- The field was initialised at first with
2
, after thata.work()
was called which changed the current value ofa.x
to the return value of callingcompute
on the result ofgetX
which simply will returnb.x
, compute is defined for B asv -> v * 2
, which madex
equal to2
.
- The field was initialised at first with
-
Q2b: Answer -> 5