jnidemo1.java
来自「精通Java核心技术源代码」· Java 代码 · 共 19 行
JAVA
19 行
public class JNIDemo1
{
public native int intMethod(int n);
public native boolean booleanMethod(boolean bool);
public native String stringMethod(String text);
public static void main(String[] args)
{
System.loadLibrary("JNIDemo1");
JNIDemo1 jd = new JNIDemo1();
int square = jd.intMethod(5);
boolean bool = jd.booleanMethod(true);
String text = jd.stringMethod("Java");
System.out.println("intMethod: " + square);
System.out.println("booleanMethod: " + bool);
System.out.println("stringMethod: " + text);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?