You are here

Java hello world program

Hello world Java program: Java code to print hello world.

Java programming source code

  1. class HelloWorld
  2. {
  3.    public static void main(String args[])
  4.    {
  5.       System.out.println("Hello World");
  6.    }
  7. }

Download Hello world program class file.

"Hello World" is passed as an argument to println method, you can print whatever you want. There is also a print method which doesn't take the cursor to the beginning of next line as println does. System is a class, out is an object of PrintStream class, and println is the method.

Output of program:
Java hello world code output