Class HelloWorldJavadoc

java.lang.Object
   |
   +----HelloWorldJavadoc

public class HelloWorldJavadoc
extends Object

class HelloWorldJavadoc is an application that prints the phrase hello, world to the standard output stream. This class must be stored in a file named HelloWorldJavadoc.java.

To compile: javac HelloWorldJavadoc.java
To execute: java HelloWorldJavadoc

Every java application must have a public static method (i.e. function) named main. The method doesn't return anything (i.e. its return type is void) and it receives one parameter: an array containing zero or more handles to String objects. Java is a case sensitive language; therefore, main, Main, and MAIN are unique names.

By convention, class names start with an uppercase letter. If the name consists of multiple words, then each subsequent word begins with an uppercase letter (e.g. StreamTokenizer, MenuBar, HelloWorldJavadoc).

This program uses the println() method which writes the contents of a String object to the standard output stream followed by a newline character. A similar method named print() could be used, but it doesn't print a newline.

At program startup (i.e. prior the the main() method being invoked), two output streams (standard out and standard error) and one input stream (standard in) are opened. Access to these I/O streams is obtained via statically defined objects located in the System class. The output objects have the names out and err, respectively, and they are objects of type PrintStream. The input object has the name in and it is of type InputStream. PrintStream and InputStream are classes found in the java.lang.io package.

The System class defines methods that provide a platform independent interface to system functions. All the methods and variables of the class are static (i.e. System objects cannot be created).