Java Naming rules

Source: Internet
Author: User

Java Naming rules

Standardized purpose: to standardize the coding process and develop good behavior habits for future program development.

 

1. All project names are in lower case

2. All package names are in lower case

3. The first letter of a class name is capitalized. If the class name is composed of multiple words, the first letter of each word must be capitalized.

For example, public class MyFirstClass {}

4. The variable name and method name are in lower case. If the name is composed of multiple words, the first letter of each word must be in upper case. (Hump type)

For example, int index = 0;

Public void toString (){}

5. All constant names are capitalized.

For example, public static final String GAME_COLOR = "RED ";

6. All naming rules must follow the following rules:

  • The name can only contain letters, numbers, underscores, and $.
  • Cannot start with a number
  • The name cannot use keywords in JAVA.
  • Chinese and Pinyin names cannot appear.

7. Maven naming rules
Both GroupId and ArtifectId are in lower case. Multiple words are separated by commas (-) and do not use hump.

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.