Java program compilation process
After completion of writing the java program, we need to save it by using .java extension
For example
public class My_Program {
-----------------------------
---------------
-----------------------------------
}
In the above program, the class name is My_Program
Save the program with file name using .java extension
===> My_program.java
After the completion of saving the program, it needs to be compiled. Java compiler is responsible for compiling the java program
===> javac My_Program.java
Whenever we compile the program, if there are no errors in the program .class file is going to be generated. If there are errors in the program .class file will not generate.
ls command ( list ) is used to find the list of files presented.
>>> ls
Whenever we type ls command it will show list of files available. It will generate .java and .class files
===> My_Program.java
===> My_Program.class
After compilation is done the .class file needs to execute by the JVM and produce the result.
===> java My_Program
No comments:
Post a Comment