JAVA syntax-based identifiers and keywords
1. The variable name, method name, class name, and object name in the identifier JAVA are all identifiers. During program writing, the identifiers must be uniquely identified for identification and reference. The naming rules for identifiers in Java are as follows: they can contain uppercase and lowercase letters, numbers, underscores, and dollar symbols in any order. It cannot start with a number. It cannot be a reserved keyword in Java. There is no length limit, but it is case sensitive. For example, Hello and hello are different identifiers. 2. Like other languages, Java also has many reserved keywords (that is, they have special meanings in Java), such as public and break. These reserved keywords cannot be used as identifiers. We don't need to memorize the keywords. knowing this is enough. If you accidentally use these keywords, the compiler can tell us this error. The following table lists the Java keywords: abstract boolean break byte case catchchar class continue default do doubleelse extend false final finally floatfor if implement import instanceof intinterface long native new null partition protected public return short limit switch between this throw limit true try void volatile ehilegoto const note: in Java Use keywords such as gogo and const, but still cannot use goto and const as variable names. Iii. Naming Conventions for Java identifiers from the perspective of Java syntax, the names are random, but in our daily programming process, to improve code readability, maintainability, and debugging convenience, we recommend that you name your code in a case-sensitive manner and follow the following rules: package name: in lowercase English words, it is better to have a hierarchy, such as com. hq. core. Class Name and Interface Name: Usually a noun, represented by one or more English words. The first letter of each word is capitalized, such as Color and FileInputStream. Method Name: it is usually a verb. The first letter of the first word is lowercase. If there are other words, the first letter is capitalized from the second word, such as main (), draw (), setColor (). Variable name or object name: Same as the method case-sensitivity rules. Constant name: declared as public static final. All letters are uppercase. Words are separated by underscores (_), for example, MAX_VALUE.