Java basic-identifiers and naming conventions, and java basic identifiers
Anything that can be named by yourself is called a modifier.
Example: Project name, package name, class name, Method Name
2.Naming rules.
① Java keywords and reserved words cannot be used, but they can contain keywords and reserved words.
② 26 uppercase/lowercase letters, numbers 0-9, $, and _.
③ Numbers can be used, but cannot be placed first.
④ There is no limit on the length theoretically, but it is best to reflect the effect of the name, follow the "Hump form", see life and wisdom.
Example: Write an ajax project instance,
Project name: ajaxtest
Package name: com. liu. ajax
Class Name: AjaxDemo
3.Usage and specifications of annotations.
In Java development, there are three types of Annotations:
① Single line comment:
// This is a single row commentaries
② Multi-line comment:
/* This is a multi-line comment, used outside the method, prompting the use of the method */
Public void show (){
Code block
}
③ Document notes:
/**
* Document comment
* Author
* Last modification time
*/
When using Eclipse for development, You can automatically generate a template for annotation. The setting steps are as follows:
Windows-Preferences-Java-Code Style-Code Template-Code
Notes:
Class Annotation
/**
* FileName: Test. java
* @ Author class creator name
* @ Date creation Date
**/
② Attribute Annotation
/** Attribute function */
Private String afgsd = null
③ Method Annotation
/**
* @ Param parameter 1 Description of parameter 1
* @ Return description of returned results
* @ Throws exception type. The error code indicates the exception thrown from this class method.
*/