Java basics 3: java Basics
Java basics Sany and keywords
Ii. identifier 2.1 Definition
Symbol used to identify something: Name: class name is a type of identifier
26 English letters, 0-9, _ and $
2.2 note
The number cannot start
It is not allowed to use keywords (you should not name Tiananmen Square if your surname is Tian, this is the name of the country)
_ And $ are used to connect words
3. Notes
Very important
3.1 Role:
Description
Debug program
3.2 category
Line comment //
Block comment /**/
Document comment /*.......... **/
3.3 note
Comments written on the interview machine, the difference between professionalism and novice veterans
Annotations are really important, and specifications are important.
From today on, write the code with comments
You can write pseudocode in the comments.
Write block comment first
Iv. definitions and classifications of constants and variables 4.1
Constant: the amount that cannot be changed
Variable: the amount that can be changed
4.2 Java Data Type
Byte, short, int, long 1, 2, 4, 8
Float dd = 2.34f
4.3 Common Errors
B1 and b2 are byte and may cross the border. If both b1 and b2 are 127
Int is the default data type, so no problem
Int x = Interger. MAX_VALUE;
5. Comparison operators of operator 5.1
5.2 logical operators
The upper part is correct, and the upper part can also be bitwise.
Dual and dual or Short Circuit
Single and Double match results are the same
5.3-bit operator
Unsigned right shift
The bitwise OR exclusive or operation is still the preceding logical operator.
5.3.0 unique or encrypted
6 ^ 3 ^ 3 = 6. You can encrypt the image or something in this way.
5.3.1>
>
>>>: Unsigned right shift. when the data is shifted to the right, no matter what the original high position is, the empty position is supplemented with 0.
5.3.2 binary Multiplication
Therefore, the shift operation is much faster.
The essence of multiplication is addition.
5.3.3 exchange two numbers
Returns the same number or the same number.
Poor reading, used during the interview
Third-party variables are used during development because
5.3.4 obtain the maximum number of three numbers
5.3.5 functions of partial code blocks
To optimize the performance, a is released.