Variable data type variable name = variable Value
Note: Variables need to be assigned, no assignment can not be used;
variables use scoped limits;
Variables cannot be defined repeatedly;
The keyword cannot be used as a variable name.
Second, solve the confusion of different data type operation
1) x-Input: Every x into one, common two or eight, 16 or 16 binary.
2) binary conversion:
Arbitrary decimal: The weighted power of the coefficient * cardinality is added
Decimal to arbitrary binary: in addition to base rewind
Computers are present in binary form and are saved and calculated in a complementary fashion.
Code Anti-code complement
byte B = (byte) 130;
130:
SOURCE 1000 0010
Inverse code negative first invariant other bit negation
Complement to find out the anti-code +1
The positive number is the same as the source counter-complement
3) Conversion
Auto-convert (implicit)
Data type variable with large range = data type value with a small range;
such as: double d = 1000;
or int i = 100;
Double D2 = i;
Cast:
Range small Data type variable = (range small data type) range large data type value;
such as: int i = (int) 6.718; The value of I is 6
or double d = 3.14;
int i2 = (int) d; The value of I2 is 3
(data type) value
Three, operators (arithmetic, assignment, comparison, logic, ternary)
1) Arithmetic: ++a first increment, then calculate
a++ first operation, then self-increment
2) Assignment: + =,-=, *=,/=,%=
3) Compare:> < >= <=! = = =
4) Logic & | ^ ! && | |
5) Ternary operator: (conditional expression)? Expression 1: Expression 2;
Iv. Process Control Statements
1) Order
2) Select
Three formats for If loop
Switch
3) Cycle
Java Notes 2