5--Keywords and reserved words in java

Definition and characteristics of keywords

Definition: Symbols (words) given special meanings by the Java language and used for special purposes.
Features: All letters in the keywords are lowercase.
Official address: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/ _keywords.html
Insert picture description here
Insert picture description here

Reserved word

Java reserved words: The current Java version has not been used, but future versions may be used as keywords. Avoid using these reserved words goto and const when naming identifiers yourself.
Pay attention to 3 points:

  1. Although goto and const have no meaning in Java, they are also reserved words. Like other keywords, they cannot be used as custom identifiers in the program.
  2. Although true, false, and null are not keywords, they are used as a separate representation type and cannot be used directly.
  3. The assert and enum keywords are added to Java.
  4. Although the word main is not a keyword, this word has a special meaning in Java, which means the entrance of the program, so it cannot be used as an identifier.

Guess you like

Origin blog.csdn.net/qwy715229258163/article/details/113667007