JAVA program, basic data type, data type conversion, variables and constants, common operators, java Operators
I. Basic Data Types
Integer type: byte, short, int (commonly used), long (usually used)
Defines a variable int a = 10;
Floating point type (decimal): float, double (commonly used)
Character Type: char (not a string)
Char B = 'A'
Escape Character class: Common \ backslash character \ t vertical tab \ r carriage return \ n line feed
Boolean (logical type): true, false
Ii. type conversion
Forced conversion and automatic conversion
Int m = 1;
Long n = 4;
N = m; short values can be automatically assigned to long values.
M = n requires us to forcibly convert the Syntax: m = (int) n
The forced conversion between values is implemented ().
3. Variables and constants
Variable: int a, B; double c = 3.14;
Constant final: values can only be assigned once. All objects share values. final double d = 3.1415;
Iv. Common Operators
Arithmetic Operators: +,-, *,/, %, ++, and ,--
Relational operators: >>=<==! =
Logical OPERATOR: & |!
Other operators: + =-= * =/= % =? : =