Analysis of Java "Hello World" Program

Consider the below “Hello World” program.

public class MyFirstJavaProgram {
   /* This is my first java program.
    * This will print 'Hello World' as the output

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


public  − scope of the class. Public means visible to all.

class  − declares the class in java.

/*    */ − Comments section.

static − marks element as static so that it can be accessed without creating the object.

void − return type of the function. void refers to nothing.

String[] args − command line arguments. 

System.out.println() − print the statement on the console.

public static void main() − the main method is startup method of java program. It is visible to all, it is static, so no object is required, and it is not returning any value.