Java variable name naming rules

Source: Internet
Author: User

$, letters, underscores start with lines, the following can be numbers, letters, underscores;Hungarian nomenclature, Camel Nomenclature and Pascal nomenclature

Hungarian nomenclature: Used in Windows programming is very common, presented by a Hungarian programmer at Microsoft. The Hungarian nomenclature identifies the scope, type, and so on, by prefixing the variable name with the corresponding lowercase letter symbol identifier. For example, M_LPSZSTR represents a long pointer member variable that points to a string that ends with a 0 character. The Hungarian nomenclature is very awkward to use in object-oriented program design.

Camel nomenclature: Camel-named, because the name of the nomenclature looks like the camel's hump. There are two forms of camel nomenclature: mixed-use uppercase and lowercase letters and words with underscores, such as Runfast and Run_fast, which are camel-named.

Pascal nomenclature: Similar to the Camel Naming Act, but the first letter of the Pascal nomenclature is capitalized.

--------------------------------------------------------------------------------------------------------------- -----------------------------------------
Two common casing Specifications:
Pascal specification: Capitalize all words in the first letter. Usernametable
Camel Specification: In addition to the first word, all words are capitalized in the first letter. Usernametable
General Practice:
Class Name: Pascal MyClass
Member Method: Pascal MyMethod ()
Normal member Variable: Pascal and begins with M_ m_membervarible
Control variables:
The control type: Pascal and begins with M_, and the name ends M_submitbutton
Value type: Pascal starts with m_ m_data1
Local variables, method parameters: Camellinecount
Global variables: Camel and start with G_ G_failedflag

Java variable name naming rules

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.