1, Java primitive type:
Java contains two basic built-in data types: object-oriented types and non-domain types. Java core is 8 primitives (Primitive) Boolean, Byte, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT. They are not objects, but ordinary binary values.
About integers: byte 8short 16int 32long 64
About floating point: float 32double 64
Regarding the character type char 16-bit unsigned integer represents Unicode (16-bit international character set), the value range 0 ~ 65535, Java allows the character type to integer, 'a' represents characters, "a" indicates the string
About the Boolean type only two values true false
2, word value
By default, the integer is an int type, and 12L is the LONG type by default, floating point is a double type, and 10.19f is a float type.
Hexadecimal: 0xFF (zero XFF) Octa: 011 (zero 11)
Character escape sequences include: / ', / ", // / r Enter, / n wrap, / f switch, / T horizontal tab, / B retracted, / DDD octal constant, / UXXXX sixteen Usual quantity
The following two examples output A: System.out.Println ("/ U0041"); System.out.Println ("/ 101");
3, Java variable scope
Similar to C language, there is a little improvement, Java does not allow name masking, (name Hiding), in the internal scope
The name of the mutant variable cannot be the same as the external variable.
In the code block, the variable is created when the variable declaration is encountered. When exiting the code block, the variable is destroyed.
4 arithmetic operator
Similar to the C language: & representation: Logic and && expand simplified with (ignore invalid expression operation) | Representation logic or || indicating simplified or (ignore invalid expression calculation) ^ indicates logic varying or!
5 Automatic Type Conversion Conditions for Automatic Type Conversion Conditions A. Two types of types compatible B. Target types are larger than the original type, such as long can turn DoubleChar and Boolean without automatic type conversion integer field value can be attached to a CHAR type variable
6 Type conversion in the expression, for example: int byte b; i = b * b; // b * B automatically converts to INTB = (byte) b * b // requires forced conversion
CHAR CH1 = 'A', CH2 = 'b'; CH1 = (CHAR) (CH1 CH2); // CH1 and CH2 automatic upgrade to int;