I have a question about variable scope.
For example:
class A {
private static void test() {
// do something with local variables
}
}
Now I make two threads, and create one instance of A for each thread.
When I call
test()in each thread, can I guarantee thattest()is thread safe?Where are the local varibles in
test()stored? Each threads' stack? Heap space?
P.S. I know that static is totally pointless in this case. I found it in our legacy code; I just wanna make sure what I know!