In this article we are going to learn some interesting things about the life cycle of a Java program.
Life cycle of a java program tells us what happens right from the point when we type source code in a text editor to the point that source code is converted into machine code (0’s and 1’s).
There are three main stages in the life cycle of a java program. They are:
- Editing the program
- Compiling the source code
- Executing the byte code
First, you will start with typing the program in a text-editor (ex: notepad, notepad++, wordpad, textedit etc). After completing editing of the program, we have to save the file. While saving the file you should remember that the file must be saved with .java extension. For example, let’s think that I had written a Java program which contains a single class Sample (more on classes in future posts). It is a good convention to save the file with the name of the class. So, as per my example, the file will be saved as Sample.java.
Second step is compilation. The name of the Java compiler is javac. The input to the compiler is Java source code which is available in Sample.java. The output of the compiler is machine independent or platform independent code which is known as bytecode. The file which is generated after compilation is .class file. As per my example, the bytecode file will be Sample.class.
Last step is execution. The bytecode generated by the compiler will be executed by Java Virtual Machine (JVM). Input to the JVM is bytecode and output is machine code (0’s and 1’s) which will be executed by the CPU of the local machine.
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Hi there, I enjoy reading all of your post. I like to write
a little comment to support you.