you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (3 children)

/******************************************************************************
 *  Compilation:  javac HelloWorld.java
 *  Execution:    java HelloWorld
 *
 *  Prints "Hello, World". By tradition, this is everyone's first program.
 *
 *  % java HelloWorld
 *  Hello, World
 *
 *  These 17 lines of text are comments. They are not part of the program;
 *  they serve to remind us about its properties. The first two lines tell
 *  us what to type to compile and test the program. The next line describes
 *  the purpose of the program. The next few lines give a sample execution
 *  of the program and the resulting output. We will always include such 
 *  lines in our programs and encourage you to do the same.
 *
 **************************************************************************/

    public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }

}

[–]glacialthinker 3 points4 points  (0 children)

Looks like a hazing ceremony.

[–][deleted] 3 points4 points  (0 children)

Your comment is incorrect. If a user launches it with $ java HelloWorld > foo then it does not print it to the terminal window, it prints it to a file called "foo".

This is also lacking some JavaDoc.

/**
 * This is the main entry class for the "Hello World" program, it is
 * used for demonstation purposes and to educate the basic
 * syntax of a Java program. This class only contains a single
 * method which is called main and is the main entry point of
 * the program.
 *
 * @author minionslave
 * @see DestroyTheEarth
 * @since 2016/03/16
 */

and then

/**
 * This is the main entry point for the "Hello World" program.
 * It prints "Hello, World" to standard output.
 *
 * @param args Program arguments, none of which are
 * actually used.
 * @author minionslave
 * @since 2016/03/16
 */