0
static along with private
If I understand this right, it means static variable have common values for all the objects created in a specific class (correct me if I'm wrong). But why does an error occur when I try to initialize an attribute with static and private property? i.e. public class Person { private String name; private static String nationality; } Help!
1 Answer
+ 1
private values access only in class but static values can be access from other classes (ex. ClassName.staticValue).so static values and functions have to be public