Hello world (First java program)

Hello world program is the first step of java programming language. Be careful when you write the java code in your text pad because java is a case sensitive programming language.

Hello world (First java program)


Java is a high level programming language and it is used to develop the robust application. Java application program is platform independent and can be run on any operating System. Writing Hello World program is very simple. To write the Hello world program you need  simple text editor like note pad and  jdk must be install in your machine for compiling and running. Hello world program is the first step of java programming  language. Be careful when you write the java code in your text pad because java is a case sensitive programming language.

 For Example

hello world   !=(not equal to) Hello World

Write the following code into your note pad to run the Hello World program .

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

Save the file and Please remember the location where you save your file. In this example we have saved the file in the "C:\javatutorial\example" directory. The file name should be match the class name and to save the file give the .java extension. e.g.  HelloWorld.java

Here is the video instruction to compile and run the HelloWorld Java program:

Now open the command prompt to compile the HelloWorld.java program. Go to the directory where you have saved the file ( in our case C:\javatutorial\example>) and issue the following command to compile the program:

C:\javatutorial\example>javac HelloWorld.java

javac is a compiler in the java Language. Java compiler change the programming Language into machinery language. So that the java virtual can understand it. Once the compilation is successful a new file will be created with the name HelloWorld.class.  To run the program issue the following command on command prompt:

C:\javatutorial\example>java HelloWorld

You will see the following result on the command prompt.

Hello World!

Here is the screen shot of the above steps:

In this lesson you have learned how to write and then test the Hello World! java program.

Share on Google+Share on Google+

Hello world (First java program)

Posted on: June 1, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Hello world (First java program)   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
what is the meaning of System,String?
February 23, 2012

plz tell the answer of the above question asap
Dantreliya Sanjay h
March 16, 2012

i receive to all the information to send my email to any java markets
March 24, 2012
java error

I get the error "unable to launch application" and on going to details it says " could not parse launch file.error at line 0" please help
Shiva kumar
June 28, 2012
pls send clarifications about these topics

class HelloWorld { == why we use this class and when? where? public static void main(String[] args){ === void main use ? System.out.println("Hello World!"); === system out use? } } because i don't know even basics also, c, c++, also don't know
Swathy Edayath
September 11, 2012
It was helpful

Thank You..
August 18, 2013

Its a very good website .its really helps me im my studies... I
February 7, 2014

i want for loop examplesin different logic
July 8, 2014
how to jearn java

i am a fresher, i don't know any about java, now i want to learn java,kindly help me, what kind of books are useful for me?
Rohit Singh
July 31, 2014
java programming

write a program to calculate area of circle and rectangle using method overloading concept