PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/java/simple/runme.java

#
Java | 32 lines | 19 code | 8 blank | 5 comment | 0 complexity | 047ba73f70102c2e0497ffbeedf967a3 MD5 | raw file
 1
 2public class runme {
 3
 4  static {
 5    try {
 6	System.loadLibrary("example");
 7    } catch (UnsatisfiedLinkError e) {
 8      System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
 9      System.exit(1);
10    }
11  }
12
13  public static void main(String argv[]) {
14    // Call our gcd() function
15    
16    int x = 42;
17    int y = 105;
18    int g = example.gcd(x,y);
19    System.out.println("The gcd of " + x + " and " + y + " is " + g);
20    
21    // Manipulate the Foo global variable
22    
23    // Output its current value
24    System.out.println("Foo = " + example.getFoo());
25    
26    // Change its value
27    example.setFoo(3.1415926);
28    
29    // See if the change took effect
30    System.out.println("Foo = " + example.getFoo());
31  }
32}