Java Naming rules _ simple and practical

Source: Internet
Author: User

Package Name:

Package Names are all lowercase nouns separated by vertices, for example, java. AWT. event;

Class Name and Interface Name:

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

For example, class helloworldapp;

Method Name:

It is often composed of multiple words. The first word is usually a verb, the first letter is lowercase, and the first letter of each word in the middle is

Uppercase, for example, balanceaccount and isbuttonpressed;

Variable name:

The name must be in lowercase. It is generally a noun, for example, length;

Constant Name:

Constants of the basic data type are named in uppercase. If they are composed of multiple words, they can be separated by underscores,

Example: int year, int week_of_month;

 

If it is a constant of the object type, it is a mix of upper and lower cases, separated by uppercase letters.

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.