- 1. Java virtual machine execution process:
Compile the source file *. java. However, the source file cannot be recognized by virtual machines. Therefore, you must use the javac command to compile the source file *. Java into *. Class. When a virtual machine is working, first load the class, read the content of the class to be executed, and read the content of other classes used in the class.
The bytecode verification is performed when the Java program is executed. If the verification fails, the verification is rejected by the operating system. To protect the security of the operating system.
Before the interpreter is executed for the operating system, the interpreter is used to interpret the *. Class content as the code that can be recognized by the current operating system. Different operating systems have different interpreters, while JDK has different JDK for different operating systems.
(1) numeric type:
1. Integer:
(1) The byte type 1 byte value ranges from-128-127.
(2) Short short integer 2 bytes
(3) int integer 4 bytes
(4) Long Integer 8 bytes
2. Floating Point Type
(1) float Single-precision floating point 4 bytes
(2) double floating point type 8 bytes
(2) balanced type:
Char 2 character → stored in integer type
(3) Boolean
Boolean logical type 1 byte → Boolean cannot be assigned a value
Variables must be initialized before use; otherwise, the compilation is incorrect.
Constant: it is a memory space with a name, but the content in the space cannot be changed during running.
Benefits of defining constants: 1. Business names can be introduced for Constants
2. Once the constant is changed, you can "change all ".
- 5. identifier naming rules:
1. A class name starts with an uppercase letter and uses the camper name method.
2. The variable name and method name start with lowercase letters and use the camper name method.
3. All constant names are capitalized.
- Vi. Conversion principles
(1) automatic conversion:
1. Values of small types can be automatically assigned to large types. Values of small types are automatically converted to large types before values are assigned.
2. When performing operations on small and large types, the small type is automatically converted to large type before calculation.
(2) forced conversion:
If the type is large to small, the forced conversion method may cause loss of precision.
Operator number:
+,-, *,/, And % (Note: % modulus → can be understood as remainder. Usage: Example: 102% 10 = 2)
Logical operator number: &, | (& represents and, | represents or)
Relational operators: >,<, >=, <=, =, and ,! = (Note: = is a comparison, and = is a value assignment. The two values are not the same .)
Note: To compare whether strings are equal, you cannot use = to use equals ()
- 8. I = I + 1 Understanding
I = I + 1 meaning: the value of I + 1 is assigned to I