Hello World Explained

Hello World Explained

Hello World in JAVA explained

Hello World is the starting step in any programming language but it also carries a meaning to start programming . In case of Java, the Hello World program is given by following codes

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

And the output will be

In the above code public class HelloWorld

  1. public : The access specifier used to define access for the class
  2. class : Define type to specify what is the code for
  3. HelloWorld : Name of the java Class.

The name of the class must be in camel case i.e if there are multiple words attached then the first letter of the word must be in capital letter.

  1. { : Opening of class and methods denoted by opening delimiter
  2. } : Closing of class and methods denoted by closing delimiter

The { } is the body of class and methods which contains statements.

public static void main(String [] args){ ....} : Anything which is followed by (){} is method containing multiple statements. This is the main method of the class, which is the entry point for any java program. In this case every keyword has different meaning so the signature of the main method must be same. The thing that we can change is String [] args to String args [] or String ... args as this is String array.

  1. public : Access specified to main method. After using this specifier main method can be used anywhere because the main method must be executed by java runtime.
  2. static : Its a keyword which belongs specially to the class and whose value do not change in overall scope. The main method must be static because Java Virtual Machine loads the class in memory and calls the main method.
  3. main : It is the name of method which can not be duplicated and when a class starts to execute it runs this method.
  4. String [] args : String array of name args is defined which is capable of accepting single argument of type string.

Share this on facebook

Subscribe to our Youtube Channel

Leave a comment

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