Hi,
yes, for what regards variables defined in the method, they are
created in a different copy for every executing thread. Of course this
doesn't happen to variables defined outside the method, and this is
the case where synchronization could be required.
So long,
Stefano
> Hi all
>
[quoted text clipped - 5 lines]
>
> Steven
Matt Humphrey - 28 Mar 2008 12:30 GMT
> Hi,
>
> yes, for what regards variables defined in the method, they are
> created in a different copy for every executing thread. Of course this
> doesn't happen to variables defined outside the method, and this is
> the case where synchronization could be required.
This is true and in addition there is a separate copy of local variables
each time the method is activated, including multiple instances within the
same thread.
Matthew Humphrey http://www.iviz.com/
stevenjiang.au@gmail.com - 28 Mar 2008 13:09 GMT
> > Hi,
>
[quoted text clipped - 8 lines]
>
> Matthew Humphreyhttp://www.iviz.com/
Thank you very much for that.
stevenjiang.au@gmail.com - 28 Mar 2008 13:08 GMT
On Mar 28, 10:06 pm, Stefano Brocchi
<stefano.broc...@researchandtechnology.net> wrote:
> Hi,
>
[quoted text clipped - 15 lines]
>
> > Steven
Thank you very much.
Lew - 28 Mar 2008 13:27 GMT
> Thank you very much.
You actually don't need to permanently fill the newsgroup archives with
numerous redundant and superfluous unnecessary repetitive frequent but polite
"thank you" posts. Just let the information stand on its merit for all to see.

Signature
Lew
>Just want to ask when multi-thread execute the exact the same method
>what happened?
>
>each thread create its own space to save method variables....??
>Thanks
Local variables live on a stack. Each thread gets its own stack. So
each thread has its own copy of any local variables. However they
share the instance and static variables. You have to use locking,
volatile and other tricks to make sure the threads don't interfere
with each other.
See http://mindprod.com/jgloss/thread.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com