EN
Java naming convention - static final class fields - private and public
5
points
1. Overview
All static final class fields in java should be upper case with underscore between words.
2. Sun Microsystems PDF - Java Coding Style Guide
3.3 Field naming
Names of fields being used as constants should be all upper-case, with underscores separating words.
The following are considered to be constants:
- All static final primitive types (Remember that all interface fields are inherently static final).
- All static final object reference types that are never followed by "." (dot).
- All static final arrays that are never followed by "[" (dot).
Examples:
- MIN_VALUE,
- MAX_BUFFER_SIZE,
- OPTIONS_FILE_NAME
Achut Reddy - Server Management Tools Group - Sun Microsystems
Links to this pdf:
3. JDK examples
// java.lang.Boolean
public static final Boolean TRUE = new Boolean(true);
public static final Boolean FALSE = new Boolean(false);
// public static final Class<Boolean> TYPE = (Class<Boolean>) Class.getPrimitiveClass("boolean");
// java.lang.Math
public static final double E = 2.7182818284590452354;
public static final double PI = 3.14159265358979323846;
// java.lang.Character
public static final int MIN_RADIX = 2;
public static final int MAX_RADIX = 36;