Java naming default specification

Source: Internet
Author: User
Tags naming convention

When you learn Java, the name of the case is often confused, so summarize the Java naming convention here

1.project (project name)

Eg:arraytest, tentative lowercase,

2. Package Name

lowercase, eg:package arrayapp;

can also be divided into partial names, domain name beginning, eg:com.frontfree.javagroup;

3. Class Name/Interface name

Capital letter, Eg:public class arrayapp{}

4. Method name

First letter lowercase, other words capitalized, eg:public void GetName () {}

In general, the Get method is prefixed with GET, eg:getname ();

Boolean type, prefixed with IS, eg:isempty ();

The setting method of the class, prefixed with Set, Eg:setname ();

5. Variable name

First letter lowercase, eg:int nelems=0;

To differentiate between data types, it is recommended to set this type to strClassName, which indicates that the variable is of type str

6. Constant name/static variable

static int Thread_flag

public static final String game_color= "RED";

Java naming default 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.