5 Star 163 Fork 1

神经猫 / scalacpptest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Sample1.java 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
神经猫 提交于 2016-08-03 18:55 . 添加相关说明
//测试前请更换包名为example,放到jexample是为了防止与scala冲突
package jexample;
class Sample1 {
// --- Native methods
public native int intMethod(int n);
public native boolean booleanMethod(boolean bool);
public native String stringMethod(String text);
public native int intArrayMethod(int[] intArray);
static{
System.loadLibrary("Sample1");
}
// --- Main method to test our native library
public static void main(String[] args) {
Sample1 sample = new Sample1();
int square = sample.intMethod(5);
boolean bool = sample.booleanMethod(true);
String text = sample.stringMethod("java");
int sum = sample.intArrayMethod(new int[] {1, 1, 2, 3, 5, 8, 13});
System.out.println("intMethod: " + square);
System.out.println("booleanMethod: " + bool);
System.out.println("stringMethod: " + text);
System.out.println("intArrayMethod: " + sum);
System.out.println("执行完毕");
}
}
Scala
1
https://gitee.com/smirkcat/scalacpptest.git
git@gitee.com:smirkcat/scalacpptest.git
smirkcat
scalacpptest
scalacpptest
master

搜索帮助