Java Compile and Run Program

In this tutorial you will learn about the Java Compile and Run Program and its application with practical example.

Creating, Compiling, and Running a Java Program

Clear all the difficulties related to java compile and run the program with just one click. Get step-by-step solutions for your project.

Editing Java Program

Step 1:- Create a file called “HelloWorld.java” using a text editor program of your choice. The .java file extension is used to specify the java language file.

Step 2:- Let’s open the “HelloWorld.java” file that we created, put the following line of code in it, and save it.

The println() is a function that tells java to display or output the content inside the parentheses.

Compiling Java Program

Step 3:- Now, go to the terminal and switch to the project directory and run the following command to compile the java program we created.

Running Java Program

Step 4:- After compilation the .java file gets translated into the .class file(byte code). Now we can run the program. To run the program, type the following command and press enter –

Once the java program is executed it will print “Hello, World!”.

Output:-

In this tutorial we have learn about the Java Compile and Run Program and its application with practical example. I hope you will like this tutorial.