
.png)
 
"A native method is a java method whose implementation is provided by non-java code."
在定义一个native method时,并不提供实现体(有些像定义一个java interface),因为其实现体是由非java语言在外面实现的。下面给了一个示例:
package java.lang;
 
public class Object { 
    
    ......
    
    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; 
    ......
    
} 
原文:https://www.cnblogs.com/sxhjoker/p/11349330.html