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

前端 未结 19 2206
灰色年华
灰色年华 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:13

    If you use private static variables in your class, Static Inner classes in your class can reach your variables. This is perfectly good for context security.

提交回复
热议问题