Java Learning Note Two--identifiers and keywords

Source: Internet
Author: User

Identifier definition

Definition of identifiers: The sequence of characters used to name features such as various variables, methods, and classes becomes an identifier.

Simply put, the name of the place where you can call the identifier, the rules of the identifier must abide by.

Naming rules
    1. Identifiers can only consist of letters, underscores "_", Dollar Signs "$", or numbers
    2. Identifiers can only start with a letter, underscore, or dollar symbol
    3. Identifiers cannot be Java keywords and reserved words
    4. Identifier case sensitive, unlimited length
Conventional

In order for Java code to be better maintained and aesthetically pleasing, it is common to write Java code that follows some established rules:

    • Identifiers may be made up of a number of words or abbreviations, but the name cannot be too long
    • When a word consists of multiple words, the first letter is lowercase, and the other words are capitalized in a mixed case, such as: UserName.
    • Class name capitalized, other (variable name, method name, etc.) First letter lowercase
Key words

Keywords are strings in Java that are assigned specific meanings and are used for specialized purposes. All Java keywords are in lowercase english.

Goto and const, although never used, are also reserved as Java keywords

All keywords are as follows:

Abstract Assert Boolean Break Byte
Case Catch Char Class Const
Continue Default Do Double Else
Enum Extends Final Finally Float
For Goto If Implements Import
instanceof Int Interface Long Native
New Package Private Protected Public
Return Strictfp Short Static Super
Switch Synchronized This Throw Throws
Transient Try void Volatile While

Java Learning Note Two--identifiers and keywords

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.