Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
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.
 
Search Tutorials:
 
Software Solutions and Services
 

 
Google Custom Search:
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation

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

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.

 

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

13 comments so far (
post your own) View All Comments Latest 10 Comments:

Hi,

I have dowmload and Installed JDK1.6.0_11
when I am putting in the C:\javatutorial\example>javac HelloWorld.java in the command prompt I am getting the follwing reply is not reconized as a internal or external command please help.

Posted by Jan Pretorius on Friday, 12.19.08 @ 02:04am | #82958

hi, i am learning java.
C & C++ has a software (compiler) which vwe can execute. but in case of java id this the only option to execute ie to run in commend prompt. dont v have software where v can write the programm n execute.

Posted by naveen on Monday, 10.13.08 @ 23:34pm | #81058

i dont understand how to run the program in vista's command promt

Posted by a beginner on Saturday, 10.11.08 @ 03:08am | #81005

hi, i too new to java- i just run the hello world program, no output it comes back to command prompt! ---- any idea why? plz help

Posted by shashi on Tuesday, 08.5.08 @ 19:22pm | #71143

Iam a biginner to java i think this is helping me a lot to understand the basic concepts of jave, could you please let me know what i should do as a bignner.

Posted by jaipal on Saturday, 01.19.08 @ 05:52am | #45553

i m a beginner to java and want to learn more thru tutorials.do send me.at the given mail i.d.daily.

Posted by minakshi on Wednesday, 01.16.08 @ 13:09pm | #45335

Iam a biginner to java i think this is helping me a lot to understand the basic concepts of jave, could you please let me know what i should do as a bignner.

Posted by kiran on Sunday, 09.30.07 @ 19:33pm | #30508

Really nice tutorial

Posted by Sojan Chandy Therakom on Friday, 03.30.07 @ 12:52pm | #12978

this program is good

Posted by krishnakartheek on Tuesday, 03.6.07 @ 10:13am | #10806

I am beginner to java, please gives me more help to run my program dan more information for this program

Posted by honey on Monday, 02.26.07 @ 06:38am | #9609

Training Courses
Tell A Friend
Your Friend Name
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.