Basic Java concepts (comments, identifiers and keywords)

1. Annotation

Comments are an important part of our Java program. Reasonable comments can make our code highly readable and make the management and maintenance of our project easier. For a qualified engineer, the comment part of the code will occupy 1 of the entire code. /3.

The essence of the annotation is that the compiler will not compile this part if it finds the content of the annotation when compiling the program.

There are three types of comments in Java:

》Single line comment: // Comment content

》Multi-line comment: /* Comment content*/ 

》Notes on the documentation:  /**  starts and ends with  */ , making it easier for you to record your program information.

2. Identifiers and keywords

Any program is actually an integrated body of structure. There are different structures in Java, such as: class structure, method structure, variable structure, etc. There must be different instructions for different structures. Then the description of the structure is actually an identifier, and there are naming requirements, but it generally requires meaningful words. The composition of the identifier in Java is defined as follows: It is composed of letters, numbers, underscores, and $. The beginning of numbers cannot be used, and reserved words or keywords in Java cannot be used.

For example, StudentName, Student_Name, Student_Name1, but "$" generally has a special meaning, and it is not recommended to use it in our programs.

Keywords are the description and processing of some structures by the system and have special meanings. For example, public and class are all keywords.

There are many keywords in Java, and there are some short explanations for some keywords:

"In JDK1.4, there is an assert keyword for exception handling;

"Enum keyword appeared in JDK1.5, used for enumeration definition;

"Unused keywords: goto, const;

》Words with special meanings are not considered keywords strictly speaking: true, false, null.

 

Guess you like

Origin blog.csdn.net/qq_25036849/article/details/108730315