The Obligatory Hello World Program
Just as in C, every Java application must have a main() method. Unlike C, everything in Java must be a class. We will go into classes in more detail in the second hour.

System.out is the standard output stream that corresponds to stdout in C and cout in C++. Java also provides System.in and System.err for access to the standard input and error streams. At this time there are no formatted output facilities like printf in C or the extensive facilities in C++.


public class HelloWorld{
  public static void main( String[] args ){
   System.out.println( "Hello World!" );
  }
}
Note that above we called main() a method. Method is the object-oriented term for a function or procedure.
Link to the source code.