Difference between public static and private static variables

前端 未结 5 1752
星月不相逢
星月不相逢 2020-12-02 15:07
class Employee{
 // salary  variable is a private static variable
private static double salary;

// DEPARTMENT is a constant
 public static final String DEPARTMENT =         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 15:34

    Obviously, you cannot access private static variable from outside the class, and you can access public static variable from everywhere.

提交回复
热议问题