Showing posts with label world. Show all posts
Showing posts with label world. Show all posts

Wednesday, September 14, 2011

First Java Program

Get going with java! Start with this program that prints "Hello World".

browse

package org.megha.blog.example.part1;

/**
 * This class prints "Hello World".
 *
 * <p>
 * If you are not using eclipse or another IDE, 
 * here are the commands to execute to compile
 * and run your first java program.
 * <p>
 * To compile (run the command after $ 
 * in java-through-examples/ directory)
 * <pre>
 * $ javac -d bin -s src src/org/megha/blog/example/part1/*
 * </pre>
 * <p>
 * To run (from the same folder, ie. java-through-examples/)
 * <pre>
 * $ java -classpath bin \
 *      org.megha.blog.example.part1.HelloWorld
 * </pre>
 */
public class HelloWorld {

        public static void main(String args[]) {
                System.out.println("Hello World");
        }
}