/* related posts with thumb nails */

procedure to implement a Java program:

Implementation of a Java application program involves a series of steps. They include:

1. Creating the program

2. Compiling the program

3. Running the program

Creating the Program: We can create a program using any text editor like notepad. But, we need to make sure that the program name should be saved with the extension “.java”. Advisably, the name of the program should match with the name of the public class or a class that has main() method.

Example: assumed that the program name is “Test.java”

class Test


public static void main(String as[])


System.out.println(“Hello Apoorva”);



Compiling the program: Java program involves two steps for its execution: one compilation and the other execution. We use “javac” tool to compile java program. This yields byte code file whose extension is “.class”. This is an intermediate file and not directly executable.

Syntax: javac Test.java

Running the Program: Now, java program is interpreted by the tool “java” which as an interpreter. This is different for different machines. This tool generates executable code for the machine in use. Thus one can view the output of the java program.

Syntax: java Test

The complete steps to run a java program are listed below:

1. Type the program in the DOS editor or notepad. Save the file with a .java extension.

2. The file name should be the same (advisably) as the class, which has the main method.

3. To compile the program, using javac compiler, type the following on the command line:

Syntax: javac

Example: javac abc.java

4. After compilation, run the program using the Java interpreter.

Syntax: java (without the .java extension)

Example: java abc

2. The program output will be displayed on the command line.

Related Topics:


Post a Comment