Java Code Example for Hello World Program

Every beginner who starts programming in any language writes Hello World Program. Java Programmer is not exception for Hello World program. Below is the java version of Hello World Program.

/****************************************************************************************
 * Created on 09-2011 Copyright(c) http://kodehelp.com All Rights Reserved.
 ****************************************************************************************/
package com.kodehelp.java.basic;

/**
 * Created by http://kodehelp.com
 * Date: 9/22/11
 */
public class HelloWorld {
    public static void main(String[] args){
        //Print Hello World on the console
        System.out.println("Hello World");
    }
}

To start with Hello World java program you need to create HelloWorld.java file, Once you created file write class HelloWorld. The name of class and the name of the file should be same and it is case sensitive. We have also added first line for package declaration, which means HelloWorld.java file will be palce com\kodehelp\java\basic directory

A main(String[] args) method is the execution entry point for any java program and we have System.out.println() method to print the Hello World on the console output.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.