Lifecycle of a Java Program

The above figure explains the lifecycle of a Java Program. In words, the figure can be explained as:

  1. A Java program is written using either a Text Editor like Textpad or an IDE like Eclipse and is saved as a .java file. (Program.java)
  2. The .java file is then compiled using Java compiler and a .class file is obtained from it. (Program.class)
  3. The .class file is now portable and can be used to run this Java program in any platform.
  4. Class file (Program.class) is interpreted by the JVM installed on a particular platform. JVM is part of the JRE software

About JVM

java virtual machine(jvm) is a software. which is machine dependent. every machine has a different jvm but the interpreting code is same,
which help for running any java programs.
it is a interpreter

jvm work is following types

    • class loading
    • byte code varification
    • give memory of function one time
    • run the garbage collector
    • generate a exception
  • create a buffer memory for any object

it can secure our java prog. from any unauthorized code.