In this tutorials, we are going to learn the basic Java Hello world example. Hello world Java program is the good starter program for all Java beginners.

Instead of directly going to dig into the hello world program, it is better to know the structure of the typical Java program since it is very important for all Java beginners like advantages of Java programming Language.

Structure Of  Java Class:


class <clsname> {
Variable declaration;
Method definition;


Here, class is a keyword which is used for developing or creating user defined datatypes.

Clsname represents a JAVA valid variable name and it is treated as name of the class.

Class names are used for creating objects.

Class contains two parts namely variable declaration and method definitions.

Variable declaration represents what type of data members which we use as a part of the class.

Method definition represents the type of methods which we used as part of the class to perform an

Structure of Java Hello world Program :


class <clsname> {
    Data member’s declaration;
    User defined methods;
    public static void main(String k[]) {
        Block of statements ();


Java Hello world Example :


package com.onlinetutorialspoint.javaprograms;

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World !");


[tie_list type=”checklist”]

  • Every program in JAVA must be developed with respect to class.
  • Data member’s declaration represents the type of data members which we use as a part of the class.
  • User defined methods represents the type of methods which we use as a part of the class to perform some meaningful operation by making use of the data members of class.
  • Here main represents the name of the method where the program execution starts and void represent return type of main method which indicates main method does not return anything.
  • Since main method is executing only once hence it must be static method.
  • Since the main method can be called/accessed by everybody and hence it belongs to public method.
  • Block of statements represents the valid executable statements of JAVA which will call the
    user defined methods.


Happy Learning 🙂

About the Author:

Founder of Love Java, Python, Shell and opensource frameworks. Follow him on twitter and facebook for latest updates.

Leave A Comment