What are the different steps involved to execute a Java program?

JavaObject Oriented ProgrammingProgramming

Java program execution follows 5 majors steps

  • Edit - Here the programmer uses a simple editor or a notepad application to write the java program and in the end give it a ".java" extension.
  • Compile - In this step, the programmer gives the javac command and the .java files are converted into bytecode which is the language understood by the Java virtual machine (and this is what makes Java platform independent language). Any compile time errors are raised at this step.
  • Load - The program is then loaded into memory. This is done by the class loader which takes the .class files containing the bytecode and stores it in the memory. The .class file can be loaded from your hard disk or from the network as well.
  • Verify - The bytecode verifier checks if the bytecode loaded are valid and do not breach java security restrictions.
  • Execute - The JVM interprets the program one bytecode at a time and runs the program.
Published on 23-May-2019 14:18:39