Home >Java >Javagetting Started >what is java identifier
In the Java language, an identifier is a string starting with a letter, underscore (_) or dollar sign ($) and consisting of letters, numbers, underscore (_) or dollar sign ($). Identifiers are case-sensitive and have no limit on length.
In Java, we need to identify many elements of the code, including class names, methods , fields, variables, package names, etc. The name we choose is called an identifier and follows the following rules: (Recommended learning: java course )
(1) The identifier cannot be a keyword or true, false, null.
(2) Identifiers can contain letters, numbers 0-9, underscores (_), or dollar signs ($).
(3) The first character of the identifier must be a letter, underscore (_) or dollar sign ($).
(4) Identifiers are case-sensitive and have no maximum length specified.
Examples of legal identifiers: age, $salary, _value, __1_value Examples of illegal identifiers: 123abc, -salary
It is best to name the identifier to reflect its function and be visible. Know it
For example: The following identifier is legal:
myName,My_name,Points,$points,_sys_ta,OK,_23b,_3_,Myvoid
The following identifier is illegal:
#name,25name,class,&time,if
The above is the detailed content of what is java identifier. For more information, please follow other related articles on the PHP Chinese website!