1, Keyword: In fact, a language has given special meaning to the word.
Reserved words: In fact, there is no special meaning, but prepare the words to be used later.
2, identifier: is actually a custom noun in the program. such as the class name, variable name, function name. Contains 0-9, A-Z, $, _;
Attention:
1), the number may not begin.
2), the keyword cannot be used.
3, constant: is the data that does not change in the program.
4, variable: In fact, is a storage space in memory, used to store constant data.
Function: Convenient for operation. Because some data is uncertain. So determine the noun and storage space for the data.
Features: Variable space can be reused.
When do I define a variable? As long as the data is uncertain, the variable is defined.
What are the necessary elements for the opening of variable spaces?
1, what data does this space store? The data type.
2, what's the name of this space? The variable name.
3, what is the first data for this space? The initialization value of the variable.
Scope and lifetime of variables:
Scope of the variable:
The scope starts at the position defined by the variable and ends with the curly brace where the variable is located;
Life cycle:
The variable is alive in memory starting at the defined position;
When a variable reaches its scope, it disappears in memory;
Data type:
1): Basic data type: Byte, short, int, long, float, double, char, Boolean
2): Reference data type: Array, class, interface.
Level from low to High: Byte,char,short (these three levels)-->int-->float-->long-->double
Automatic type conversion: from low to high level, the system automatically turn;
Coercion type conversions: When to use? Assign a high-level number to a variable that has a low rank for that number;
Operation Symbols:
1), arithmetic operator.
+-*/%: Any integer modulus 2 is not 0 is 1, so as long as the change is the module can be implemented switch operation.
+: Connector.
++,--
2), assignment operator.
= += -= *= /= %=
3), comparison operator.
Features: This operator is characterized by the result of the operation, either True or false.
4), logical operator.
& | ^ ! && | |
Logical operator except! are used to concatenate two Boolean expressions.
&: Only both sides are true and the result is true. Otherwise, it is false.
|: If both sides are false the result is false, otherwise it is true
^: xor: And or a little different.
On both sides, the result is false.
It is true that the results are different on both sides.
& and && difference: &: Whatever the left result is, the right side is involved in the operation.
&&: Short circuit with, if the left is false, then the right side is not a parameter and operation.
| and | | Difference: |: Both sides are calculated.
|| : Short circuit or, if the left is true, then the right side does not participate in the operation.
5), bitwise operator: operator used to manipulate bits.
& | ^
<< >> >>> (unsigned Right shift)
Java Basic syntax