Hello everyone, here I come again!! LA, I know you miss me very much, I want to quickly write more articles to improve their level, well, I am from you. Now come with me. Java Phase II, applause, applause!!!
Chapter II:
In this chapter, I'm going to tell you something. variables, common Java data types, variable naming rules, encoding specifications, data types, and variable names are used.
(1) First introduce variables
Variables also have their own properties: variables, variable names, variable types, values of variables
We can imagine it in a hotel:
| Rooms in the hotel |
Variable |
The data stored by the variable can be easily and quickly found, |
| The Code of the room |
Variable name |
Calling a variable is taking the data out of that room, |
| The Code of the room |
Variable type |
A variable is a basic unit for storing data, |
| Check-in Guests |
The value of the variable |
Different variables are independent of each other. |
Data type:
| Int |
Plastic |
Used to store integers |
| Double |
Double-precision floating-point type |
Used to store decimal numbers |
| Char |
Character type |
Used to store a single character |
| String |
String type |
Used to store a string of characters |
Different types of data need to be stored in different sizes of memory space. Of these, Int,double,char are all Java-defined keywords.
It is important to note that string char is the format for storing data in string = "Hello"; the format of storing data in char is char = ' man '; string format must have quotation marks, character type is single quote!
Variable name naming specification:
(1) The variable must begin with a letter, an underscore "_" or a "$" symbol
(2) A variable can include a number, but cannot start with a number
(3) In addition to the "_" or "$" symbol, the variable name cannot contain any special characters
(4) Keywords that cannot be used in the Java language, such as int, class,public, etc.
There is no limit to the length of the Java variable name, but the Java language is case-sensitive, so price and price are two completely different variables, and the Java keyword cannot be used as a variable name, revolver, package name, etc.
Coding specification:
(1) Class name must be decorated with public
(2) Write only one statement on a line
(3) Parts enclosed in {} usually represent a certain level of the program. "{" is usually placed at the bottom of the start line of the structure, the first letter of the "}" structure to it, and the exclusive one line
(4) The first level of statements or comments should be more than a level of statements or comments indented a number of spaces to write, so that the program more clear, enhance the readability of the program.
In this chapter, the key code is not too much, so I hope we all firmly remember:
SYSTEM.OUT.PRINTLN ("* * * *");
The contents of the output in double quotes
Speaking of which, the second chapter is almost over. Finally tell everyone an artifact, I only tell you, others do not know. Hush! MyEclipse, this software is accompanied by Java, so the need to practice frequently friends best download installed on their own computer for the convenience of their own use. It can be an error, although it is in English, we can search Baidu to answer. All right, it's over. The next issue will bring you to Java Chapter Three. Then we will contact the code, next time Goodbye, Wood, love you.
The next section will bring you more articles about Java. If you think I write the article can bring you a harvest, then I also hope you can leave footprints, and later I will be more efforts to bring more knowledge to everyone. Look forward to my next issue, everybody~.
Java Summary Phase II