constant
Constant: During the program run, a fixed amount of unchanged
Java, constants into literals and symbolic constants
literal constant value means that the amount can see directly, such as 123
, 3.1415
, "hello"
, ......
Constant Category:
- String constants: all due to partial double quotation marks, called string constants
- Integer constants: write directly on the numbers, there is no decimal point
- Float constant: to write directly on the numbers, decimals
- Character constant: to cause the single quotes single character (there is one and only one character), a character named constants
- Boolean constants: only two values,
true
for true,false
on behalf of false - Empty constants: writing
null
, also java in a keyword, representatives空
, without any reference data (note: empty constants can not be directly used to print output)
variable
Identifiers, keywords
Identifier: refers to the program in order to represent some things, user-defined 名字
keywords: Some identifiers have special meaning system pre-defined
reserved words: pre-defined system, not as a keyword, but also does not allow users to use
Identifier naming 规则
:
- Identifier only by numbers, letters, underscores
- Identifiers can not begin with a numeral
- And keywords and identifiers can not be reserved words of the same name