What is the use of a private static variable in Java?

前端 未结 19 2142
灰色年华
灰色年华 2020-12-02 03:47

If a variable is declared as public static varName;, then I can access it from anywhere as ClassName.varName. I am also aware that static members a

相关标签:
19条回答
  • 2020-12-02 04:39

    ThreadLocal variables are typically implemented as private static. In this way, they are not bound to the class and each thread has its own reference to its own "ThreadLocal" object.

    0 讨论(0)
提交回复
热议问题