Web-android Engineer first-2-5 How to name Java variables

Source: Internet
Author: User

Source: http://www.imooc.com/code/1221

As the hotel will give each room a personalized name, the variables in the program also need to use a reasonable name for the management---variable name!

It is important to note that the name of the hotel room can be a number, such as "802", can also be interesting names, such as "Peony", "President of the United States", "Water curtain hole", etc., but in the name of the variable must conform to certain rules , as follows:

The following variables are named in accordance with the specification:

But take a look at the following code, you know ha:

The habit of good siege master:

1, the variable name consists of multiple words, the first letter lowercase , followed by the first letter of the word capitalization , commonly known as camel-named method (also known as hump name), such as MyAge

2, when the variable name, as short as possible and can clearly express the role of variables, do see the name of understanding . Such as: Define variable name stuname save "student name" information

The length of the Ps:java variable name is not limited , but the Java language is case-sensitive , so price and price are two completely different variables Oh!

Task

In order to facilitate the maintenance of the program, the variable name must conform to the specification Oh.

In the editor, write code in the white space within the main method, define two variables, save the "I love Class Net" and "www.imooc.com" two strings, and implement the printout

Operation Result:

 Public class helloworld{    publicstaticvoid  main (string[] args) {        = "I adore the net" ;         = "Www.imooc.com";        System.out.println (Love);        System.out.println (addr);    }}

Web-android Engineer first-2-5 How to name Java variables

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.