Key Words: words that are given special meaning in Java have a special purpose. identifiers:Consists of a letter, a number, an underscore (_), a dollar sign ($), cannot begin with a number, cannot be a keyword in Java, a reserved word, a case-sensitive, or a name meaning. variables: Essentially, a variable is actually a small area of memory that represents storage space for storing constant data, declare and re-use the value first Syntax: variable-type variable-name = variable-value, naming specification is the same as identifier. the first letter of the variable name is lowercase and the first letter of the other word is capitalized. constants: * Allow assignment only once, no change is allowed during program run* Syntax: final constant name = value* The use of constants in the program can improve the maintainability of the Code* Constant names generally use uppercase charactersData type:JAva is a strongly typed language, and data stored in Java is of a type. 1*, basic data type (native data type, the data itself is stored)* Numeric type:--integer type; *byte, 1 bytes -128-127*short,2 bytes -32768-32767*int 4 bytes*long 8 bytes--floating-point *float 4 bytes must end with F*double 8 bytes* Character type: Char 2 bytes* Boolean: Boolean 1-byteThe reference data type (object data type, the data address is stored, and is typically created with new)* Classes (Class), interfaces (interface), arrays ([])specification of the use of variables; *: Variables are declared before use (local variables must be assigned first)*: The variable can be initialized simultaneously when used*: Only one value can be assigned at a time in a variable, but multiple times may be modified. the variable defined in the *:mian () method must be assigned before it can be output*: Variables within the same scope cannot be defined repeatedlydata type conversions: 1, automatic type conversion:* Target type is compatible with source type* Destination type is greater than source type2, coercion type conversion:* Syntax: (data type) values* Forced type conversion may result in loss of dataOperator:Operator:1, arithmetic operator:+ Plus-minus * multiply/divide% modulo + + self-increment-subtract + string concatenation++a, the first self-increment and then assign value. A + first assignment and then self-increment2, assignment operator:= + = = *=/=%= &= |= ^= <<= >>= >>>= ~= 3, comparison operator : = = Equal ! = Unequalthe operands on both sides can be numeric and reference types> < >= <= instanceofthe operands that support only the left and right sides are numericinstanceof---Judge the relationship of an object to a class--can only be used for reference data typesfeature: The result of the operation is either True or FALSE, 4, logical operator : & with | or! Non-^ xor&& Short circuit with | | Short circuit or short circuit function, high execution efficiencydifference between & and && : &: Regardless of what is on the left, the right side is involved in the operation. &&: Short circuit with, if the left is false, then the right side does not participate in the operation. | and | | The difference: | Both operations on both sides || Short circuit or, if the left is true, then the right side does not participate in the operation. 5, ternary operator: logical value? Expression 1: Expression 2if the logical value is true, the expression 1 is executed, whereas the expression 2 is executed.
Java Lesson two, Java Foundation 2