Explain working Java Virtual Machine

Explain working Java Virtual Machine ?

Answer : Below are steps:

  • User creates *.java file
  • Using javac (Java compiler) it gets compiles from *.java file into *.class file ( A Java compiler is a compiler for the Java programming language. The most common form of output from a Java compiler is Java class files containing platform-neutral Java bytecode. There exist also compilers emitting optimized native machine code for a particular hardware/operating system combination. Most Java-to-bytecode compilers, Jikes being a well known exception, do virtually no optimization, leaving this until run time to be done by the JRE)
  • The Java Virtual Machine (JVM) loads the class files and either interprets the bytecode or just-in-time compiles it to machine code and then possibly optimizes it using dynamic compilation.A standard on how to interact with Java compilers programmatically was specified in JSR 199.
  • Converted Machine code or machine language is a set of instructions executed directly by a computer central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.
  • Below is diagram of machine code which is difficult to read by human. So it will be converted to human readable medium.

Explain working Java Virtual Machine

Note: A human-readable medium or human-readable format is a representation of data or information that can be naturally read by humans.

In computing, human-readable data is often encoded as ASCII or Unicode text, rather than presented in a binary representation. Virtually all data can be parsed by a suitably equipped and programmed computer or machine; reasons for choosing binary formats over text formats usually center on issues of storage space, as a binary representation usually takes up fewer bytes of storage, and efficiency of access (input and output) without parsing or conversion.

Finally machine code encoded by human readable format by java Charset class and we do see the output.

Leave a Reply

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

I am not Robot *