This is with reference to HFS, Pg 202, last Q <There are no Dumb Qs>
To my understanding, this mentions ways in which multiple threads can access a common value. But then it says:
"1. Declare the variable as a local variable within the service method, rather than as an instance variable..."
I thought that local varibales are thread safe, and instance variables were not, so inorder for multiple threads [I] to [I]sharethe value, shouldn't the variable be as an instance variable. ie: shouldnt 'instance variable' and 'local variable' be swapped in teh above sentence in the book ? Or am I missing some point?
I looked up the errata, couldn't find any related to this point. Please help me with this query, as the concepts get mixed up otherwise.
posted 11 years ago
I think your right. What they're trying to accomplish is unclear from the question. Are they trying to share a variable or a value? That's what is muddled.