Hello World

  • Put the following code into a file (e.g., hello.java)
    public class Hello {
        public static void main() {
            System.out.println( "Hello world!" );
  • compile using the following command:
    > javac hello.java
  • Run using the following command
    > java hello
  • System is a class
  • out is a static member of the System class of type PrintStream
  • println() is a method of PrintStream