Java naming practice

xiaoxiao2021-03-06  110

1. The bag letters are written. Hierarchical, separated by the junction. com.sun.medialib com.sun.jdi.event

2. Class, the first letters of each word each word. Using nouns or noun phrases, the Timer BufferedWriter interface can also be named with a "-able" or "-ible" ending. Runnable Accessible

3. Method, the first word lowercase in the domain, the first letter of each word later. Methods to perform actions are typically named with a verb or verb phrase. APPEND DRAWIMAGE For returning Boolean worthwhile, its name is often starting with a word "IS", followed by a noun or noun phrase, or any word or phrase with adjective function. Isdigit isprobablePrime ISEMPTY ISENABLE If the method returns a non-Boolean function or attribute that is called object, it is often named with a verb phrase that starts with verb "get". Size hashcode gettime If the class where a method is located is a bean, it is enforced to use the "get" form in the form of "GET". The method of converting the object type, returns a method of different types of independent objects, commonly referred to as Totype. Tostring Toarray Returns a view of a view is often referred to as ASTYPE. ASLIST returns a method of the original language type with the called object, is often referred to as TypeValue. INTVALUE Static Plant common name is Valueof and GetInstance.

4. Constants every letter is capitalized, and the intermediate is separated by underline. VALUES NEGATIVE_INFINITY

5. The first word of local variables is lowercase, and the first letter of each word will be capitalized. The meaning of allowing abbreviations, individual characters, and short character sequences depends on the context environment where local variables are. i xref housenumber

转载请注明原文地址:https://www.9cbs.com/read-124579.html

New Post(0)