Java Hello World

I DONT LIKE CODING

PATRIOTS ARE CHEATERS

From JavaProgramming

Build and run a HelloWorld program in Java

Writing a Java program is simple enough:

 /* HelloWorld.java */
 public class HelloWorld {
   public static void main(String[] args)  {
   System.out.println("Hello world!");
   }
 }

Build the program by typing this at the command line:

 D:\>javac HelloWorld.java

(Java SDK must be installed on your machine, and the Java binaries must be in your system path)

Run the program by typing:

 D:\>java -classpath . HelloWorld

The output will be:

 Hello world!

Notice that the argument to the interpreter is the name (case sensitive) of the class that contains a main() method.


See LearningJava MyJavaCourse


EditText of this page (last edited January 22, 2008) or FindPage with title or text search