jdk source class reading -Object

native keyword

private static native void registerNatives();
    static {
        registerNatives();
    }

public final native Class<?> getClass();

public native int hashCode();

protected native Object clone() throws CloneNotSupportedException;


public final native void notify();


public final native void notifyAll();


public final native void wait(long timeout) throws InterruptedException;

When native C ++ is developed jointly with! java to develop their own unused!

Use native Keyword Description This method is a native function, that is, this method is to use C / C ++ language, and compiled as DLL, to call the java.
Achieve these bodies function in the DLL, JDK source code is not included, you should not see. For the different platforms they are also different. This is the underlying mechanism of java, java is actually calling different native methods on different platforms to achieve access to the operating system.



1. native is used java and other languages (such as c ++) to collaborate with the time
that is achieved after the native function is not written in java
2. Since it is not java, then leave it alone source code, huh, huh



native, which means that notifies the operating system,
this function you must give me realize, because I want to use.
So the function keys are the native operating system implementation,
the Java can only be called.

Guess you like

Origin www.cnblogs.com/panchangde/p/12021123.html