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

In this, tutorial will guide you through Creating, Compiling, and Running a Java Program.

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 java language file.

Step 2:- Let’s open the “HelloWorld.java” file that we created, and 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 terminal and switch to the project directory and run the following command to compile 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:-

Recommended:-  Java if else statement
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.