I have a question about variable scope.
For example:
class A {
private static void test() {
// do something with local variables
}
}
When I call test() in each thread, can I guarantee that test() is thread safe?
Yes it would be thread safe if in test() method you are working on method local variables.
Where are the local varibles in test() stored? each threads' stack? heap space?
Method Local variable are stored each thread's own stack.