1. Package
All letters are in lowercase. Hierarchy, separated by periods. Com. Sun. medialib com. Sun. jdi. Event
2. Classes and interfaces
The first letter of each word is capitalized. Using a noun or noun phrase, the timer bufferedwriter interface can also be named by an adjective ending with "-able" or "-visible. Runnable accessible
3. Methods, Domains
The first word is in lowercase, and the first letter of each word is in uppercase.
The method for executing an action is usually named by a verb or verb phrase. Append drawimage
For a Boolean method, its name often starts with the word "is", followed by a noun or noun phrase, or any word or phrase with an adjective function. Isdigit isprobableprime isempty isenable
If the method returns a non-Boolean function or attribute of the called object, a noun, noun phrase, or verb phrase starting with the verb "get" is often used to name it. Size hashcode gettime
If the class of a method is a bean, the format starting with "get" is mandatory.
The method for converting object types and returning a different type of independent object is usually called totype. Tostring toarray
The method for returning a view is usually called astype. Aslist
Return a primitive type method that is the same as the value of the called object. It is usually called typevalue. Intvalue
The common static factory names are valueof and getinstance.
4. Constants
Each letter is in uppercase and separated by an underscore. Values negative_infinity
5. Local Variables
The first word is in lowercase, and the first letter of each word is in uppercase. Abbreviations are allowed. The meaning of a single character or short Character Sequence depends on the context where the local variable is located. I xref housenumber