Is there any naming convention for java constant variable?
Normally we use variables with names containing uppercase letters and underscores(_).
For example:
public final class DeclareConstant {
public static final String CONSTANT_STRING = "some constant";
public static final int CONSTANT_INTEGER = 5;
}
Yes. That is it. It is often used for
enumas well.The only common exception is for logging where you might see
but I prefer
LOGI often write this as UPPER_CASE, but I also write TitleCase for classes and camelCase for variables and methods.