Java Programming specification

Source: Internet
Author: User

* Packages with full English descriptors should be made up of lowercase letters. For the global package, reverse your Internet domain name and add the package name. Such as:
java.awt
Com.ambysoft.www.persistence

* Class is a full English descriptor with the first letter of all words capitalized. Such as:
Customer
SavingsAccount

* Interface (INTERFACE) uses a full English descriptor to describe the interface encapsulation, the first letter of all words capitalized. Traditionally, the name is appended with the suffix able, ible or er, but this is not required. Such as:
Contactable
Prompter

* Components/components (Component) Use the full English description to describe the purpose of the component, end Bell on the component type. Such as:
OKButton
CustomerList
Filemenu

* Exceptions (Exception) usually use the letter E to indicate an exception. E

* class variable fields are described in full English, with the first letter lowercase and any intermediate words capitalized in the first word, such as: FirstName
LastName

* Naming rules for argument/parameter same field/attribute
public void Setfirstname (String firstName) {
This.firstname = FirstName;
}

* Naming rules for local variables with fields/attributes

* * Gets the member function preceded by the Access field name prefixed by get. Getfirstname (), Getlastname ()

* * Boolean get member function all Boolean get functions must be prefixed with the word is. Ispersistent (), isstring ()

* * The set member function is preceded by a prefix set for the Access field name. Setfirstname (), Setlastname (), Setwarpspeed ()

* * The general member function uses the full English description to describe the function of the member function, the first word as far as possible to use a vivid verb, the first letter lowercase. OpenFile (), AddAccount ()

* Static and Constant fields (static final) are all uppercase letters, and the words are separated by underscores. Min_balance, Default_date

* The loop counter is usually accepted using either the letter I,j,k or the counter. I, J, K, counter

* Array arrays should always be named in the following way: byte[] buffer;

Java Programming specification

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.