home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / NativeExample.java < prev    next >
Encoding:
Java Source  |  1997-07-23  |  472 b   |  17 lines

  1. class NativeExample {
  2.     public static native void Display(String str);
  3.     public static native long Sub(long a, long b);
  4.     public static native void Fibonacci(int i);
  5.  
  6.     static {
  7.         System.loadLibrary("native");
  8.     }
  9.  
  10.     public static void main(String args[]) {
  11.         Display("5 - 2 = " + Sub( 5, 2) + "\n");
  12.     for(int i=0; i<args.length; i++)
  13.         /* call a native method from java */
  14.         Fibonacci(Integer.parseInt(args[i], 10));
  15.     }
  16. }
  17.