Sunday, 5 July 2015

Creating and Running a Java Program

Implementation of  a java application program involves a series. They include Creating the program, compiling the program, running the program. Here the detailed explanation of each and every step.

  1. Creating the program
  2. Compiling the program
  3.  Running the program.
Note: Before we begin creating the program, the java development kit(JDK) must be properly installed on our system.

1.Creating the program

                              we can create a program using any text editor. Assume that we have entered the following program.


      Class Test
         public static void main(String args[])
           System.out.println(" Hello!");
          System.out.println(" Wecome to the world of java ");
          System.out.println(" Let us learn java");

 save the file name with the class name that will appear above the main method, with .java extension.

 2.Compiling the program 

                                 To compile the program, we must run the java compiler javac, with the name of the source file on the command line as shown below.


 If everything is ok, the javac compiler creates a file called Test.class containing the bytecode of the program.

   3. Running the program.

                                      We need to use the java Interpreter to run a standalone program. All the command prompt, type

                               Java Test

Now, the interpreter looks for the main method in the program and begins execution from there. When execution, our program displays the following

                               Welcome to the world of java.
                               Let us learn Java. 


Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

python tutorial


C Programming


Java Tutorial


Data Structures


MS Office


Database Management