JavaSE review to 4: constants, variables, keywords, identifiers

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:

  1. String constants: all due to partial double quotation marks, called string constants
  2. Integer constants: write directly on the numbers, there is no decimal point
  3. Float constant: to write directly on the numbers, decimals
  4. Character constant: to cause the single quotes single character (there is one and only one character), a character named constants
  5. Boolean constants: only two values, truefor true, falseon behalf of false
  6. 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 规则:

  1. Identifier only by numbers, letters, underscores
  2. Identifiers can not begin with a numeral
  3. And keywords and identifiers can not be reserved words of the same name

Guess you like

Origin www.cnblogs.com/wbyixx/p/11845566.html