nativeexample.java
来自「Java样例程序集合:2D」· Java 代码 · 共 32 行
JAVA
32 行
public class NativeExample { private int myValue; static { Runtime.getRuntime().loadLibrary("example"); } NativeExample(int v) { myValue = v; } native static String quote(int index) throws IllegalArgumentException; native int twoTimes(); native NativeExample doubleUp(); public static void main(String[] args) { String s = quote(2); System.out.println("Testing quote(): \"" + s + "\""); NativeExample ne = new NativeExample(13); System.out.println("Testing twoTimes() " + ne.twoTimes() + " (should be 26)"); ne = new NativeExample(24); NativeExample ne2 = ne.doubleUp(); System.out.println("Testing doubleUp() " + ne2 + " (should be 48)"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?