An identifier is a name that refers to a type, a variable, or a method.
-
The first letter of the identifier's name must be:
- a letter ([A-Z|a-z] or a Unicode character),
- a currency symbol ($),
- or an underscore (_).
Example variable names:
int c;
int $;
char \u0061; // \u0061 : a
int _; // Not allowed with Java 11
-
The first letter of the identifier can be followed by:
- a combination of letters,
- digits,
- the currency symbol ($),
- and the underscore character (_).
Example variable names:
int cb3$_;
int $c1$_;
int _a2$_;
char c\u0061;
-
Identifier names cannot contain spaces or symbols like "+" or "©".
-
Identifier names cannot use Java keywords such as "
public
", "static
", "void
", etc.
-
Identifier names are case-sensitive (
intVar
is different from INTVAR
).