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.
Java Programming » Core Java Basics » Life cycle of a java program
Suryateja Pericherla Categories: Core Java Basics. 2 Comments on Life cycle of a java program
3.6
(37)

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:

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


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


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?

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.

2 Comments

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

just leave comment for you work

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 *

Facebook
Twitter
Pinterest
Youtube
Instagram