Compiling the program converts the code from a human readable format which we entered in Notepad, into a “ bytecode” which is executed by the Java Virtual Machine (JVM).
Before we can run the program we have to compile the Java program.
The steps below explain how to compile and run Java program using the command prompt or cmd. In this Java tutorial we will first look at how we can run the Java program on Windows and after that we will go through the code to understand it. The best way to learn programming is by running the program. How To Run Java Program In Command Prompt or cmd
The file name should match the class name.
Since Java is case sensitive, the capitalization of the class name should match the file name.
A single source file can contain multiple classes (which we will see later).
java extension for the Java compiler to compile the file
In Java, the source file is a compilation unit and the name given to the source file is quite important.