jniexample.java
来自「java核心编程的部分源码」· Java 代码 · 共 30 行
JAVA
30 行
/**
* 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() );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?