learn programming in 30 days
  • Java virtual machine:

  • JVM, i.e., Java Virtual Machine.
  • JVM is the engine that drives the Java code.
  • Mostly in other Programming Languages, compiler produce code for a particular system but Java compiler produce Bytecode for a Java Virtual Machine.
  • When we compile a Java program, then bytecode is generated. Bytecode is the source code that can be used to run on any platform.
  • Bytecode is an intermediary language between Java source and the host system.
  • It is the medium which compiles Java code to bytecode which gets interpreted on a different machine and hence it makes it Platform/Operating system independent
  • A specification where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Oracle and other companies.
  • An implementation Its implementation is known as JRE (Java Runtime Environment).
  • Runtime Instance Whenever you write java command on the command prompt to run the java class, an instance of JVM is created.
  • The JVM performs following operation:
    • Loads code
    • Verifies code
    • Executes code
    • Provides runtime environment.                                  
  • JVM generates a .class(Bytecode) file, and that file can be run in any OS, but JVM should have in OS because JVM is platform dependent.
  • Java is called platform independent because of Java Virtual Machine. As different computers with the different operating system have their JVM, when we submit a .class file to any operating system, JVM interprets the bytecode into machine level language.
    • JVM is the main component of Java architecture, and it is the part of the JRE (Java Runtime Environment).
    • A program of JVM is written in C Programming Language, and JVM is Operating System dependent.
    • JVM is responsible for allocating the necessary memory needed by the Java program.
    • JVM is responsible for deallocating memory space.

0 Comments