One of the basics of Java: Naming rules (package name, class name, variable name, method name)

Source: Internet
Author: User

1. Package Name: Package name is usually lowercase English letter

2. Class Name: Capitalize the first letter of the word

3. Variable Name:

1) identifiers consist of letters, numbers, underscores "_", dollar Sign "$" or the renminbi symbol "¥", and the initial letter cannot be a number.
2) Keywords and reserved words cannot be identified as identifiers.
3) identifiers do not have a length limit.
4) The identifier is case sensitive.

4, Method name: First word lowercase, after the first letter of the word capital

Note that the default byte storage for different variable types. Java decimal is the default double type, such as above (float) 4.5, if you write 4.5 directly, will be in the place of 4.5 red wavy line, indicating that this place is wrong.

One of the basics of Java: Naming rules (package name, class name, variable name, method name)

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.