aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Multiple Threads to access a value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Multiple Threads to access a value" Watch "Multiple Threads to access a value" New topic
Author

Multiple Threads to access a value

Ruchi Kumar
Greenhorn

Joined: Feb 16, 2005
Posts: 7
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.

Regards,
Ruchi.
P. Dunn
Ranch Hand

Joined: Feb 22, 2005
Posts: 34
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.


P.Dunn<br />SCJP, SCJD, SCEA & SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Threads to access a value