Java Naming conventions

Source: Internet
Author: User
Naming rules for packages, classes, methods, properties, constants in Java

1: Package: Used to classify classes that do different functions, put them under different directories (packages), and package naming conventions: reverse the company domain name as the package name. For example, www.baidu.com for package name: each letter needs lowercase. For example: Com.baidu.test; The full name of the test class under the package is: Com.baidu.Test.java.

If the package is not used when defining a class, then Java will assume that the class we define is in the default packages. 2: Class: Capitalized, if a class is composed of multiple words, the first letter of each word is capitalized, and no connector is used in the middle. Use English as much as possible. such as ConnectionFactory 3: Method: The first word is all lowercase, if a method is composed of multiple words, start with the first letter from the second word, do not use a connector. Addperson 4: Properties: Same as method. such as Ageofperson 5: constant: All words are uppercase letters, if there are more than one word, then use the underline link.  For example: public static final int age_of_person = 20; Usually plus static

Java Naming conventions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.