Java核心代码例程之:JNIExample.java
2008-01-05 08:38:24 来源:WEB开发网核心提示:/** * This class is a simple example that uses a native function * @author Renga **/public class JNIExample {static {System.loadLibrary( "JNI" );}/**
/**
* This class is a simple example that uses a native function
* @author Renga
**/
public class JNIExample {
static {
System.loadLibrary( "JNI" );
}
/**
* Native method declaration. Just returns the string "Hello World from JNI!"
* @return A string
**/
public native String sayHello();
/**
* Main method
* @param args Command-line arguments
**/
public static void main( String[] args ) {
// Create a new JNIExample object
JNIExample temp = new JNIExample();
// Invoke the native method
System.out.PRintln( temp.sayHello() );
}
}
赞助商链接