Java virtual machine

Java virtual machine

  • A Java compiler produces a binary file called a class file which contains the byte code for a Java program. The Java virtual machine loads one or more class files and executes programs contained in them. To achieve it, the JVM requires the support of the class loader, which locates a required class file, and a byte code verifier, which ensures that execution of the byte code would not cause any breaches of security.
  • The Java virtual machine is a stack machine. By contrast, a stack machine performs computations by using the values existing in the top few entries on a stack and leaving their results on the stack. This arrangement requires that a program should load the values on which it wishes to operate on the stack before performing operations on them and should take their results from the stack.
  • The stack machine has the following three kinds of operations:
    • Push operation: This operation has one operand, which is the address of a memory location. The operation creates a new entry at the top of the stack and copies the value that is contained in the specified memory location into this entry.
    • Pop operation: This operation also has the address of a memory location as its operand. It performs the converse of the push operation—it copies the value contained in the entry that is at the top of the stack into the specified memory location and also deletes that entry from the stack.
    • n-ary operation: This operation operates on the values existing in the top n entries of the stack, deletes the top n entries from the stack, and leaves the result, if any, in the top entry of the stack. Thus, a unary operation operates only on the value contained in the top entry of the stack, a binary operation operates on values contained in the top two entries of the stack, etc.
  • A stack machine can evaluate expressions very efficiently because partial results need not be stored in memory—they can be simply left on the stack
Read More: Features of JAVA

Java virtual machine

Download the Android app to get all Government Job Notifications on your Mobile.
Download Now
Important: Please always Check and Confirm the above details with the official Advertisement / Notification.
Previous Post Next Post