Native method in java and javanative Method
Native is used for joint development with C ++! Java development is not required!
The native keyword indicates that this method is a native function, that is, this method is implemented in C/C ++ and compiled into a DLL, which is called by java. The implementation of these functions is in the DLL, And the JDK Source Code does not contain them. You should not see them. They are also different for different platforms. This is also the underlying mechanism of java. In fact, java calls different native methods on different platforms to access the operating system.
- Native is used for java and other languages (such as c ++) for collaboration, that is, the implementation of native functions is not written in java.
- Since it is not java, don't worry about its source code.
Native means to notify the operating system. You must implement this function for me because I want to use it. Therefore, functions with native keywords are implemented by the operating system and can only be called in java.
Java is a cross-platform language. Since it is a cross-platform language, the cost is to sacrifice some control over the underlying layer, while java must implement control over the underlying layer, we need help from other languages. This is the role of native.