Java Road of the Gods (2)-marker

Source: Internet
Author: User

Marker

1.1 marker : A valid sequence of characters used to flag the class name, variable name, method name, type name, and file name as a marker.

1.2 naming rules:

The Java language specifies the identifier by letter (a-za-z), underscore (_), dollar sign ($) and a number (0-9) , and the first character cannot be a number.

Specific details:

The ① marker is made up of letters, underscores, dollar signs, and numbers, and is unlimited in length.

The first character of a ② glyph cannot be a numeric character.

The ③ glyph cannot be a keyword.

The ④ flag cannot be true, FALSE, and null.

In addition, there are many common naming conventions in Java, these are generally referred to as project specifications, in actual programming, the project specification is very important to the project, the enterprise also attaches great importance to the code of a person. In general, the common identifier naming conventions are:

variable :1> If it is a single word, the words are all lowercase letters. such as: int count;

2> if it is a compound word made up of multiple words, except for the first word, then all the first letters of the word

Capital. such as: int sumscore; (This naming method is called the Hump nomenclature, also known as the Hungarian nomenclature).

constants: constants All words are capitalized, and if they are made up of multiple words, they are connected by underscores. such as:

public static final String person_name = "Zhangsan";

method: The method naming specification is similar to a variable, such as count (); Getsum ();

class: The first letter of all words in the class name is capitalized. such as person{}, datacenter{};

Package: named with a lowercase inverted domain name. Format: Prefix + project name + module name + layer such as:

Org.itfuture.domain.sorts;

See the Java Coding Specification (Huawei)

Java Road of the Gods (2)-marker

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.