Identifier is the ‘name of identity’ given to any entities such as class, function, variable etc. An identifier is used to identify these entities in a unique way. An identifier must follow a specific naming convention in order to avoid any conflict with the keywords. The following rules must be followed while creating an identifier.
1. An identifier can contain lowercase alphabets (a to z) or uppercase alphabets (A to Z) or digits from 0 to 9 or an underscore (_). It could be a combination of all these entities. No other special characters are allowed. Some of the examples of valid identifier are var_5, tempVariable and fullName.
2. The first character of an identifier should not be a number. It can only start with a character or an underscore. Ex. var1 or _var1. An invalid identifier would be 1Var.
3. An identifier is case sensitive. Var1 and var1 are completely different variables.
4. An identifier can be of any length. However, it is always advised to keep it short and easy to understand.
5. Keywords should not be used as identifiers.
Note: It is a good practice to use camel Case to name the identifiers such as variables, functions etc. The class names must always start with uppercase character.