This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, Is it possible for a Thread to access a local variable created by other Thread? For example, Thread x access a method and create a local variable. Thread x has not finished, but then Thread y access the same method and also create a local variable. Is it possible for Thread y to access the local variable created by Thread x?
The purpose of the ThreadLocal class is indeed to create variables that are specific to a thread, but it's used for member or static variables. As has already been (correctly) stated in this thread, the local variables of a method, static or not, are unique to that single method invocation, and are never shared with any other invocation on the same or any other thread.