Keyword: A special meaning used by the Java language as a special purpose string (word), all characters of the keyword are lowercase
Reserved words: Now the Java version is not used, but later versions may be used as a keyword, the name of the keyword to avoid the use of these reserved words
Cast, future, inner, outer, rest, Var, goto, constant
Identifier: A sequence of strings used by Java to name features such as variables, methods, classes, and so on
Rules for legal identifiers
1. Uppercase and lowercase English characters, numbers, underscores, dollar signs
2, the number can not start
3. Keywords and reserved words may not be used
4. Java is strictly case-sensitive
5. Cannot contain spaces
Variable: A storage area in memory that has its own name and type
Each variable in Java must be defined, and in use, the area's data can change continuously within a certain range
Scope of use of variables: within a pair of curly braces
Variable is a variable name to access this area
Categories of variables:
Specific data types are defined for each data type, and memory space is allocated in memory for different sizes
Classification of variables (varies by declaration location)
Variables declared within a class are called member variables outside of the method body
A variable declared inside a method body is called a local variable
Similarities and differences in initial values:
Same point: Both have a declaration period
Different points: Local variables require explicit initialization in addition to formal parameters
Integer type: Byte, short, int, long
Java Each data type has a fixed representation range and field length, not affected by the platform, to ensure the cross-platform of the program
Java integer type, default to int, to be declared as long needs to be added later l,l
Floating-point type: Default is double
Character type: (Escape character is character type), two bytes
Three representations of character constants
1. Single character with single quotation mark
2. Escape character
3, using the Unicode value to represent,
Data of type char can be run
ASCII code
Inside the computer are binary representations, each binary data has 0 and 12 state representations, so every 8 binary can represent the state of 256, which is called a byte
ASCII Code table: the correspondence between English characters and bits, occupying only the next 7 bits, and the first unification is 0
Disadvantages:
Cannot represent all the characters
Unicode:
Unicode is just an encoding set that specifies the binary encoding of the symbol, but does not specify how the binary code should be stored: the computer cannot distinguish between three bytes representing three characters or one character
UTF-8
A Unicode implementation, a variable-length encoding format that varies by byte length according to different symbols
Conversions for basic data types:
Conversion of automatic types: small-capacity types are automatically converted into large-capacity data types
Data types are not converted between byte, short, and char types, and they are first converted to int type
Other data types are automatically converted to string types when any type of data and string are performed with a + operation
Java Basic syntax