You can use globally defined constants by defining them inside a class and referencing themwithout instantiation.
public class CONSTANT { |
Since the members of the class are defined as "static", there is no need to instantiate the class. To use a constant, simply use CONSTANT.[constant name]
if (myMethod()==CONSTANT.SUCCESS) {
...;
}
else {
...;
}
For details: Java Tips
No comments:
Post a Comment