One, data type
1, underlying data type
Integral type:
Byte (8bit)
Short (16bit)
Int (32bit)
Long (64bit)
Floating point type:
Float (32bit)
Double (64bit)
Character type:
Char
Boolean type:
Boolean
2, reference type
String type
String
3. Data type Conversion
(1) Automatic data type conversion:
Rule 1: If one operand is of type double, the entire expression can be promoted to a double type.
Rule 2: Conditions for automatic type conversions are met.
(2) Forcing data type conversions:
Example
Two, variable
1, declare the format of the variable:
Data type variable name = value of variable;
2, examples of each type:
3, naming rules for variable names:
(1) The variable must begin with a letter, an underscore "_", or a "$" symbol;
(2) A variable may include a number, but cannot begin with a number;
(3) except "_", "$" symbol, can not include any special characters;
(4) You cannot use keywords in Java, such as: int,class,new, etc.
4 various types of assignment need to pay attention to
(1) A value of type char is required to be ' caused;
(2) The value of string type is to be caused by ""
(3) Boolean value can only be true, false both;
Three, operator
1, assignment operator
= Assign the right value to the left
Example
2, arithmetic operator
Subtraction to take the remainder
+ - * / %
3, relational operators
> Greater than
< less than
>= greater than or equal to
<= less than or equal to
= = equals
! = does not equal
Primary knowledge of java-variables, data types and operators. 2