• Post Reply Bookmark Topic Watch Topic
  • New Topic

multi threading with static metlhods  RSS feed

 
Vasco Carmona
Greenhorn
Posts: 13
Firefox Browser Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

I have a question about static methods in multithreading environment.

With the code below, I expected to lose the reference of "ints" with each thread initialization, since the method is static.

I thought all thread would end up with the "ints" reference of the last thread that would be initialized.



Can anyone explain why is this happening?

Thanks all in advance
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ints is a local variable. Each method call has its own copy.
 
Vasco Carmona
Greenhorn
Posts: 13
Firefox Browser Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!