BrianMc1958
asked on
Use getters and setters on static fields?
Dear Experts,
Is there an "industry standard" for accessing static fields? I normally use private fields with getters and setters now. But in the case of static fields, is it worthwhile to bother? It seems a lot simpler to just do:
String myString = MyClass.SOME_STATIC_FIELD;
and declare SOME_STATIC_FIELD to be public and final.
Thanks,
BrianMc1958
Is there an "industry standard" for accessing static fields? I normally use private fields with getters and setters now. But in the case of static fields, is it worthwhile to bother? It seems a lot simpler to just do:
String myString = MyClass.SOME_STATIC_FIELD;
and declare SOME_STATIC_FIELD to be public and final.
Thanks,
BrianMc1958
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Access restrictions and checking of set-values are just the same!
;JOOP!