I would like to use the following constant:
final String ADD = "Add text";
However, my CheckStyle tool tells me that 'ADD' does not match the pattern '^[a-z][a-zA-Z0-9]*$'.
Could anyone please tell me what is wrong with 'ADD'? Means '^[a-z][a-zA-Z0-9]*$'
that every name has to start with a low character? Is there no other possibility?
^[a-z][a-zA-Z0-9]*$
This regex describes something which starts with lowercase and the remainder is composed of uppercase, lowercase, and numbers. (Examples: aVariable
, variable
, aNewVariable
, variable7
, aNewVariable7
.)
If you want your field to be constant and static, use:
static final String ADD = "Add text";
Otherwise, use:
final String add = "Add text";