1. Native.
- Indicates that the method is a local method, which actually means that the method is implemented by C + + and is compiled into a DLL, which is called by Java.
- The Java language itself cannot access and manipulate the underlying operating system, but other languages can be invoked through the JNI (Java Native Interface) interface to enable access to the underlying.
2. Volatile.
- General Java memory will be divided into (method area, heap) (virtual machine stack, local method stack, program counter) and other different memory areas;
- As we all know, there is a main memory in the system, and all the variables in Java are stored in memory and shared for all threads. Each thread has its own working memory (working memory), in which the working RAM is a copy of some of the variables in main storage, the operation of all variables by the thread is in working memory, the threads cannot be accessed directly from each other, and the transfer of variables needs to be done via main memory.
- If a variable is identified for volatile, it is read from the main memory each time the change is used, and the same is written in master memory When the variable is written.
Java_ Some special keywords in detail (?) Solution