Home > Java > Javagetting Started > body text

What are the naming rules for variables in java

王林
Release: 2020-10-19 16:27:13
Original
27979 people have browsed it

The naming rules for variables in Java are: 1. It must start with a letter, underscore, or dollar sign; 2. The variable name must be composed of letters, numbers, and underscores; 3. The variable name cannot conflict with the java keyword .

What are the naming rules for variables in java

Some rules for naming variables:

(Recommended tutorial: java course)

1. It must start with a letter, an underscore, or the dollar sign $;

Variables named starting with the dollar sign$ can be compiled but are not recommended;

Chinese names can also be used as the beginning and The compilation can also pass, but its use is not recommended.

2. Except for the beginning, the following part can be composed of letters, underscores, dollar signs $, and numbers;

3. Although the length of the variable name is not limited, it can express the meaning of the name clearly. Yes;

4. Variable names cannot conflict with java keywords;

5. There is a difference between upper and lower case in renaming, even if it is named by the same word but there are individual letters The difference between upper and lower case results in two different variables.

Related recommendations:Getting started with java

The above is the detailed content of What are the naming rules for variables in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!