首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:JNIExample.java

2019-11-18 15:17:02
字体:
来源:转载
供稿:网友

/**
 * 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() );
}

}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表