![compiling java program compiling java program](https://howtoimages.webucator.com/1492.png)
![compiling java program compiling java program](https://media.geeksforgeeks.org/wp-content/uploads/CommonArticleDesign20-min-1.png)
Step 3: Open command prompt and go to the directory where you saved your first java program assuming it is saved in C drive.
#COMPILING JAVA PROGRAM CODE#
Step 1: Open a text editor and write the code as above. Steps to Compile and Run your first Java program : This is used to print anything on the console like printf in C language. We will discuss more about array in Java Array section. String args : This represents an array whose type is String and name is args.
![compiling java program compiling java program](https://i.ytimg.com/vi/H_wX7OLdS9o/maxresdefault.jpg)
If a java class is not having a main() method, it causes compilation error. This is the method which is executed, hence all the logic must be inside the main() method. Main : main() method is the most important method in a Java program. Void : It is the return type, meaning this function will not return anything. The main() method here is called by JVM, without creating any object for class. To execute a static function you do not have to create an Object of the class. Static : static is again a keyword used to make a function static. Public means this function is visible to all. Lets understand what above program consists of and its keypoints.Ĭlass : class keyword is used to declare classes in Java Since Java is a Object-oriented language so it require to write a code inside a class. It consists of various other lines of code.