Identifiers in Java, class names and package name rules

Source: Internet
Author: User

Names of packages, classes, methods, parameters, and variables in Java

Naming rules for identifiers

1. The variable must start with a letter, an underscore (_), or a dollar sign ($)

2. The remaining characters can be underscores, dollar signs, or any letters or numbers

3. You cannot use keywords in javascript or reserved words as variable names

Pascal rules (Pascal's nomenclature) : The word is not separated by a space or connection number (-), the bottom line (_), the first letter is capitalized; the first letter of subsequent words is also capitalized, for example: FirstName,

LastName. The initials of each word are named in uppercase letters, known as the Pascal Nomenclature, and are derived from the naming conventions of the Pascal language, and some call it the "big hump-type nomenclature" (Upper camel case),

A subset of camel-sized case.

Camel rule (Hump naming): Other words are capitalized except for the first word. Also called the small hump-type nomenclature.


Class Name:

Pascal rules such as: person, Studentdemo
Variable name:

Camel rules such as: Age, Height, avgvalue
Name of function:

camel rules such as: Getage, Setusername
Package Name:

All lowercase for example: om.neusoft

Identifiers in Java, class names and package name 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.