First Java “Hello World” Program

First Java “Hello World” Program

Here is the first Java program “Hello World” program for basic understanding about the Java Syntax and execution of a program.

public class HelloWorldFirstProgram {
    public static void main(String[] args) {
	    // Prints the string to the console.
        System.out.println("Hello World!");


Hello World !

See Also :

Explanation about each keyword

public: The keyword public is access modifier that denotes a method can be called from code in other classes, or that a class may be used by classes outside the class hierarchy.

static: The keyword static with method main() indicate a static method, which is associated with only class and not with the specific instance of the class. That can be called by class name.

void: The keyword void indicates that the main method does not return any value to the caller.
main method: The main method is a java launcher method, that is used to call by JVM to pass control to the program for execution.

See Also :


System.out.println is one of the most frequent statements used by java programmers for debugging purpose and prints logs in the console.

  • The System is the class defined public
  • Out is the public static object of System class of type PrintStream.
  • println() is a method of PrintSteam class as String.

See Also: Java: System.out Vs Vs System.err classes and methods.