【发布时间】:2013-07-06 06:14:54
【问题描述】:
I found that declaring a variable as static makes no sense 在多线程中。我认为,这是因为every thread has its own stack。这是唯一的原因吗?
我知道static variables should be used within synchronized block。但为什么呢?
【问题讨论】:
-
“毫无意义”是什么意思?
-
我的意思是这个值在每个线程上并不通用
-
我发现在多线程中将变量声明为静态没有意义
[citation needed]
标签: java multithreading thread-safety