How is num being accessed by the new thread. Future will execute on the new thread. how is the value of num that is in the stack frame of main thread accessible in the new thread? Where is it stored?
object TestFutureActor extends App {
var num = 10
val addNum = Future {
num = num + 2
num
}
}