Verification in Java (JVM)

JavaServer Side ProgrammingProgramming

Once the byte code is loaded by the JVM, (with the help of the .class file), the bytecode is checked to see the validity with the help of the verifier. The verifier checks the linking so as to perform operations efficiently. This way, the interpreter performs much efficiently. This process is known as verification.

Example

 Live Demo

public class Demo{
   private float my_val;
   float my_function(int my_val){
      int balance = my_val;
      this.my_val += balance;
      return this.my_val;
   }
   public static void main(String[] args){
      Demo my_obj = new Demo();
      System.out.println("The instance of Demo has been created");
      System.out.println(my_obj.my_function(3456));
   }
}

Output

The instance of Demo has been created
3456.0

A class named Demo contains a float value. Another function named ‘my_function’ adds a given value to the float value. In the main function, an instance of the Demo class is created, and the ‘my_function’ is called on this object. Relevant output is displayed on the console.

raja
Published on 17-Aug-2020 12:54:13
Advertisements