- Identifier
- Identifier 26 may comprise letters (case insensitive), numbers 0-9, and _ $ symbol underscore.
- Identifiers can not begin with an array.
- Identifiers can not be keywords.
- constant
- Concept: During the program run, a fixed amount of unchanged
- classification:
- String constants: Any partial double quotation marks, called string constants, such as: "abc", "123"
- Integer constants: write directly on the numbers, there is no decimal point. For example: 100, 200, -200
- Float constant: to write directly on the numbers, there is a decimal point, for example: 2.5, -3.14,0.0
- Character Constants: single quotes to all single character, called the character constants, such as: 'A', '1', 'medium'
- Boolean constants: only two values, true false
- Empty constants: null, no data on behalf of
type of data
Integer byte short int long
Float float double
The type char
Boolean boolean
Note : The string is not a basic type, but reference types.
Float may only be an approximation, not a precise value
Data range is not necessarily related to the number of bytes
Float among the default type is double, if you want to use a float, the need to add a suffix F,
If is an integer, the default is int type, long type if you want to use, you need to add a suffix L
variable
1. Variable names can not be repeated
2. For float and long types, the character can not be omitted and L suffix F
3. Start from the line defined variables, until the end of a direct member of the braces so far
Cast
1.byte / short / char three types can occur mathematical waybill, such as addition "+"
2.byte / short / char in the three types of operation that they will first promoted to the int type, and then in the calculation
ASCII code table
48 ->'0' 65->'A' 97->'a'
Compiler optimizations:
short result = 5 + 8; // the right of the equal sign are constant compiled for all
short result = 13;