×

Html & Html5

The World's best Software Development Study Portal

Hello World Program

In this page we learn how to write simple Java program and display "Hello World"on screen.

Class Test{

Public Static Void main(String[]args)

{

System.out.println("Hello World");

}

}


Output of program on command prompt:


output

Understanding theProgram:-

  1. Class Test:-The first statement of our code is Class Test.Since JAVA is Object oriented language and every program in Java contain atleast one class.Whatever we write must appear within opening and closing braces of class.
  2. main:-The second statement is main method. In Java like (C/C++)entry point for execution of program is methodmain which is called by JVM.
  3. Public:-Is an access modifier and in OOPS any method or variable which is declared public can be accessible outside of that class.Since main is public,JVM can easily accessed and execute it.
  4. Static:-Static methods can be call without any object,simply using class name.
  5. Void:-keyword Void is return type which indicates that no value returned by method(main)to its caller(JVM)
  6. String[]args:-is called Command Line arguement,where String is predefined class.