filmov
tv
#25 Unusual variable names in #java

Показать описание
In Java, variable names can consist of any combination of letters, digits, underscores (_), and dollar signs ($), but they must not begin with a digit. Here's a breakdown of the valid characters for variable names in Java:
Letters: You can use any Unicode letter.
Digits: Digits 0-9 can be used, but not as the first character.
Underscore (_): This can be used anywhere in the variable name, including as the first character.
Dollar Sign ($): This is technically allowed, but its use is generally discouraged except in auto-generated code, as it can be confusing.
Variable names in Java are case-sensitive, meaning variable, Variable, and VARIABLE are considered different identifiers. Additionally, Java keywords cannot be used as variable names, such as int, class, public, etc.
Letters: You can use any Unicode letter.
Digits: Digits 0-9 can be used, but not as the first character.
Underscore (_): This can be used anywhere in the variable name, including as the first character.
Dollar Sign ($): This is technically allowed, but its use is generally discouraged except in auto-generated code, as it can be confusing.
Variable names in Java are case-sensitive, meaning variable, Variable, and VARIABLE are considered different identifiers. Additionally, Java keywords cannot be used as variable names, such as int, class, public, etc.