Flat 10% & up to 50% off + Free additional Courses. Hurry up!

Hello Program in Java


Hello Program Example:

class HelloProgram{

public static void main(String args[]){

System.out.println("Hello Intellipaat");//It will print Hello Intellipaat



Type this program in notepad and save it as Hello.java.

Type below commands to Compile and execute the above program:

javac HelloProgram.java

java HelloProgram


Hello Intellipaat


Program Explanation

  • class: This keyword is used to declare a class in java.
  • public: It is an access modifier that represents visibility. It means it is visible to all.
  • static: It is a keyword. The advantage of static method is that there is no need to create object to invoke the static method if it is non static method, JVM creates objects then call main () method, this will give the problem of extra memory location. That’s why main() method is become static.
  • void: It is the return type that means it doesn’t return any value.
  • main: It represents the startup of the program. Without main program cannot run.
  • String[] args: It tells that the main() has a parameter which is an array of String references. This array is created by the Java system just before main() acquires control. The elements of the array refer toStrings that hold text from the command line that starts the program.
  • System.out.println(): It is used print statement which is inside the ().


Java Comments

It is useful to place a comment in place to indicate what you are doing. It is added into the program for making the program easier to understand and these are not compiled by the compiler or interpreter. It is useful if you want someone else to be able to ever read your code.

There are two ways to declare comment in java which are as follows:

  • Single Line comment
  • Multi Line comment


  • Single Line comment – It is used to apply the comment on a single line. To apply single line comment // is used.


System.out.println("Hello Intellipaat");  // It will print Hello Intellipaat


Multi Line comment – It is used to apply the comment on multiple lines. e.g.

System.out.println("Hello Intellipaat");  /*  It will print

Hello intellipaat */


Keywords in Java

Keywords are also known as reserved words which express a special meaning to the compiler and interpreter. Keywords in java are –

abstract assert boolean break
byte case catch char
class const continue default
do double else enum
extends final finally float
for goto if implements
import instanceof int interface
long native new package
private protected public return
short static strictfp super
switch synchronized this throw
throws transient try void
volatile while

"0 Responses on Hello Program in Java"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.


Sales Offer

  • To avail this offer, enroll before 22nd October 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer


Sign Up or Login to view the Free Hello Program in Java.