English from http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
The object uses a field to save its status:
Int Cadence = 0; int speed = 0; int Gear = 1;
JavaProgramming LanguageDefine the following types of variables:
Instance variable (non-static field)
Class variable (static field)
Local variables (variables in the method that store the temporary state)
Parameter (variable corresponding to the method signature)
The following general guidelines are used for fields and variables discussed in the rest of this tutorial. If we are talking about "general fields" (excluding local variables and parameters), we can simply say "fields ". If the discussion applies to "all the above variables", we can simply say "variables ". If the differences are made based on context calls, we will use the appropriate specific names (static fields, local variables, etc ). You can also occasionally see and use "members", such as fields of type A, methods, and nested types, collectively referred to as their members.
Each programming language has its own set of rules and conventions, and you can use the name category. It is no different for Java programming languages. Naming rules and conventions of variables can be summarized as follows:
Variable names are case sensitive. The variable name can be any legal Identifier-a sequence of Unicode letters and numbers with an unlimited length, starting with a letter, dollar sign "$", or "underline. By convention, variables generally start with letters, rather than "$" and "_". In addition, dollar signs should never be used. You may find that in some cases, the automatically generated name will contain the dollar sign, but your variable name should be avoided. The same convention exists for the underscore "_". It is technically legal to start using "_" in a variable, but this practice is not encouraged. Spaces are not allowed.
It can be followed by letters, numbers, dollar signs, or underscores. When you select a variable, use the complete word instead of the mysterious abbreviation. This will enable yourCodeIt is easier to read and understand. In many cases, it will make your code like a document (the Translator's note: code is a document, a very high level ). For example, the field is named
Gear, Which is much more intuitive than abbreviated versions, such as S, C, and G. Remember that the name you selected must not be a keyword or reserved word.
If the name you selected contains only one word, Use lowercase letters to spell all the words. If multiple words are contained, the first letter of each subsequent word is capitalized. If your variables store constant values such as static final int num_gears = 6, the conventions are slightly changed. Each letter is capitalized and each word is separated by an underscore. By convention, underlines should never be used (except for variable names that represent constants ).