![]() The names gearRatio and currentGear are prime examples of this convention. ![]() If it consists of more than one word, capitalize the first letter of each subsequent word. If the name you choose consists of only one word, spell that word in all lowercase letters. Also keep in mind that the name you choose must not be a keyword or reserved word. In many cases it will also make your code self-documenting fields named cadence, speed, and gear, for example, are much more intuitive than abbreviated versions, such as s, c, and g. Doing so will make your code easier to read and understand. When choosing a name for your variables, use full words instead of cryptic abbreviations. Conventions (and common sense) apply to this rule as well. Subsequent characters may be letters, digits, dollar signs, or underscore characters. A similar convention exists for the underscore character while it's technically legal to begin your variable's name with "_", this practice is discouraged. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. Additionally, the dollar sign character, by convention, is never used at all. The convention, however, is to always begin your variable names with a letter, not "$" or "_". A variable's name can be any legal identifier - an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_". The rules and conventions for naming your variables can be summarized as follows: Every programming language has its own set of rules and conventions for the kinds of names that you're allowed to use, and the Java programming language is no different.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |