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