Headlines News :
Home » , » My First program in Java

My First program in Java

Written By Durgesh on Wednesday, 22 February 2012 | 09:43

here we will use  program  for learning that is helloDurgesh
we will write this program with notepad or wordpad  one of this let us use notepad
Java application program is platform independent and can be run on any operating System.
Writing Hello durgesh program is very simple. To write the Hello Durgesh program you need  simple text editor like note pad and  jdk must be install in your machine for compiling and running. Hello durgesh 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.

Write the following code into your note pad to run the Hello Durgesh program .
class HelloDurgesh {
   public static void main(String args[]){
   System.out.println("Hello Durgesh!");
   }
}

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.  HelloDurgesh.java
Now open the command prompt to compile the HelloDurgesh.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 HelloDurgesh.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 HelloDurgesh.class.  To run the program issue the following command on command prompt:
C:\javatutorial\example>java HelloDurgesh
You will see the following result on the command prompt.
Hello Durgesh!

Share this article :

No comments:

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Tutorial of Programing - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger