public class NativeDemo{
int i;
public static void maina(){
NativeDemo ob=new NativeDemo();
ob.i=10;
System.out.println("This is ob.i before the native method: "+ob.i);
ob.test(); //call a native method
System.out.println("This is ob.i after the Native method: "+ob.i);
ob.test(); //call a native method
System.out.println("This is ob.i after the Native method: "+ob.i);
}
// declare native method
public native void test();
static{
// load DLL that contains static method
System.loadLibrary("NativeDemo");
}
public static void main(String args[]){
NativeDemo.maina();
}
}