Java SE Basics: Identity (zhì) character

Source: Internet
Author: User

Java SE Basics: Identity (zhì) selector, identifier definition

  Identifiers are sequences of characters that give names to classes, interfaces, methods, variables, etc.

Ii. composition rules and matters needing attention 1. Composition rules
    • English uppercase and lowercase letters
    • Array
    • $ and _
2. Precautions
    • Cannot start with an array
    • cannot be a Java keyword (see keyword table:)
    • Case-sensitive when writing (uppercase and lowercase represent two different identifiers, such as public and public are different)
Third, the naming rules of the identifiers in Java to do: see the name of the idea
  • Package: A package is actually a folder that distinguishes the structure of a file in a project, and the package name should use lowercase
    • Single-level package: Todo
    • Multi-level package: Com.rishiqing.todo
  • Classes (Class) and Interfaces (interface)
    • Name a word: The first letter of the word must be capitalized, for example: Student,dog,person, etc.
    • Name multiple words: Each word must be capitalized (named with the Hump), for example: Helloworld,kanbanexportcsv, etc.
  • method or variable (variate)
    • A word named: The first letter lowercase, for example: Name,age, etc.
    • Multiple words named: The first letter lowercase, then the first letter of the concatenation of the words to capitalize (using the Hump method named), such as: username,password,departmentnamelist, etc.
  • Constants (constant)
    • A word named: all uppercase, for example: PI = 3.1415926,e = 2.71828, etc.
    • Multiple words named: All uppercase, between words and words using "_" to connect, for example: Millis_5_min,student_name, etc.

  

Java SE Basics: Identity (zhì) character

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.