~ubuntu-branches/ubuntu/warty/swig1.3/warty

« back to all changes in this revision

Viewing changes to Examples/java/simple/main.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Landschoff
  • Date: 2002-03-29 01:56:07 UTC
  • Revision ID: james.westby@ubuntu.com-20020329015607-c0wt03xu8oy9ioj7
Tags: upstream-1.3.11
ImportĀ upstreamĀ versionĀ 1.3.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import example;
 
2
 
 
3
public class main {
 
4
 
 
5
  static {
 
6
    try {
 
7
        System.loadLibrary("example");
 
8
    } catch (UnsatisfiedLinkError e) {
 
9
      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);
 
10
      System.exit(1);
 
11
    }
 
12
  }
 
13
 
 
14
  public static void main(String argv[]) {
 
15
    // Call our gcd() function
 
16
    
 
17
    int x = 42;
 
18
    int y = 105;
 
19
    int g = example.gcd(x,y);
 
20
    System.out.println("The gcd of " + x + " and " + y + " is " + g);
 
21
    
 
22
    // Manipulate the Foo global variable
 
23
    
 
24
    // Output its current value
 
25
    System.out.println("Foo = " + example.get_Foo());
 
26
    
 
27
    // Change its value
 
28
    example.set_Foo(3.1415926);
 
29
    
 
30
    // See if the change took effect
 
31
    System.out.println("Foo = " + example.get_Foo());
 
32
  }
 
33
}