Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Core Java Basics. 1 Comment on Life cycle of a java program
3.7
(34)

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

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:


Subscribe to our monthly newsletter. Get notified about latest articles, offers and contests.


  • 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.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

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.

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

1 Comment

You can follow any responses to this entry through the RSS 2.0 feed.

Hi there, I enjoy reading all of your post. I like to write
a little comment to support you.

Leave a Reply

Your email address will not be published. Required fields are marked *