среда, 10 июня 2009 г.

Java

Sample Java program

Put the following sample code in a file called Hello.java:

public class Hello {
public static void main(String[] args) {
for (int i=0; i < args.length; i++) {
System.out.println("Hello " + args[i]);
}
}
}

Compiling Java programs

Use the javac utility to compiler a java program:

javac Hello.java

Running Java programs

Start our "java" program (Hello) and pass some arguments to it (World):

java Hello World