FileDocCategorySizeDatePackage
HelloWorld.javaAPI DocExample817Sat Mar 13 14:59:46 GMT 2004None

HelloWorld

public class HelloWorld extends Object
A trivial class to show Java Native Interface 1.1 usage from Java.

Fields Summary
int
myNumber
Constructors Summary
Methods Summary
public native voiddisplayHelloWorld()

public static voidmain(java.lang.String[] args)

 // used to show argument passing

  // declare native class
     

  // Application main, call its display method
       
    System.out.println("HelloWorld starting; args.length="+
                       args.length+"...");
    for (int i=0; i<args.length; i++)
                       System.out.println("args["+i+"]="+args[i]);
    HelloWorld hw = new HelloWorld();
    hw.displayHelloWorld();// call the native function
    System.out.println("Back in Java, \"myNumber\" now " + hw.myNumber);