JAVA package naming convention of naming rules, classes, fields, methods

Must be in English, do not use Pinyin

  1: package (package): used to perform different functions of class categories, in a different directory (package), naming the package: the company will reverse domain name as the package name. For example www.sohu.com Package name: each letter is lower case. For example: com.sohu.test; full name of a Test class in the packet is: com.sohu.Test.java. If a class definition does not use package, then java to think we have defined the class in the default package inside the (default package).

  2: Class: capitalized, if the class is constituted by a plurality of words, the first letter of each word is capitalized, but without using any intermediate connector. Try to use English. Such as ConnectionFactory

  3: Method: The first word in all lower case, if a process consists of a plurality of words, then starting from the second word capitalized, without using a connector. addPerson

  4: Attribute: the same methods. As ageOfPerson

  5: Constant: All the letters are capitalized words, if there is more than one word, use the underline link.

Guess you like

Origin blog.csdn.net/qq_25594727/article/details/86065804