Simple Java Program


Java Programming

                      Hello friends, In this blog, we see how to run the Java program. It is very simple to run the java program. To run the java code your machine must have a JDK (Java Development KIT) file. When you install it on your pc one folder named as Java is created in c drive. So, first of all, we see the simple java program to display "Hello I am Java Programmer". I will explain every stapes of the program.

Program:
class intro
{
public static void main(String args[])
{
System.out.println("Hello I am Java Programmer");
}
}
            To run the program there are two stapes in that First is Compilation and second is Interpretation.

Compilation: A compilation is one type of application softwere that translates or converts the code from human-readable code to machine-readable code i.e. in the form of 0 and 1. To make this conversion successful we must write a code on the notepad and save this code with extension .java. When we compile this code on command prompt, one same name file is created with extension .class and this file is in machine-readable form.
            To compile the java code the class name and file name must same. And to compile the code on command prompt type javac intro.java

Interpretation: Interpretation means the actual execution of the program, Once we successfully compile the program we can execute it easily. To run the java program on command prompt type java class_name i.e. java intro


Stapes to run the java program:
 Step 1: Go to that folder where your java code to be saved using the command prompt.
Step 2: Set the JDK path as shown below,



Step 3: Compile the java program using syntax javac class_name.java
      (For example, javac intro.java)


Step 4: Finally to run or execute the code type java class_name


Note: In syntax, I wrote class_name which is the same as the file name.

Output:


Simple Java Program Simple Java Program Reviewed by Amit Waghmare on December 06, 2019 Rating: 5

1 comment: