Declaring methods, principles, and naming conventions for variables

Source: Internet
Author: User

Declaration method of the variable: 1, the first declaration after the assignment int A;

A=3;

2, the definition variable is directly assigned the value int a=3;

3, you can declare multiple variables of the same type at once, separated by commas between the multi-variable names, and end with a semicolon

int zsage=18,lsage=20,wwage=30;

The declaration principle of a variable: first declare----after the assignment-----last used. Variable can be repeated assignment (but to a variable to assign a new value, then the old value in the variable is no longer exist, in the method is generally defined only once, but can be assigned multiple times, the value of the variable will be assigned to overwrite the value)

Naming rules for variables: 1, cannot start with a number 2, cannot repeat with keywords in C # 3, the same variable name cannot be defined repeatedly 4, case sensitive (camel named first word letter lowercase after each word initials capitalized in English words)

Declaring methods, principles, and naming conventions for variables

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.