dynamic binding gives lesser execution time than static binding
<p>Consider the following code:</p>

<pre><code>    import java.io.*;
    import java.util.*;

    class parent{
      private static int static_count;
      final void static_display(){
       for(int i=0; i&lt; 1000000; i++){
         Object obj = new Object();
       }
       System.out.println("Static method called"+static_count+"times");    
      }
      public void dynamic_display(){
        System.out.println("implemented in child");
      } 
    }

    class child extends parent{
      private static int dynamic_count;
      public void dynamic_display(){
        for(int i=0; i&lt; 1000000; i++){
          Object obj = new Object();
        }
        System.out.println("dynamic method called"+dynamic_count+"times");    
      }
    }

    class sample{
      public static void main(String args[]){
      parent pnt= new parent();
      parent pnt2=new child();
      //static binding
      long startTime = System.nanoTime();
      pnt.static_display();
      long elapsedTime = System.nanoTime() - startTime;

      System.out.println("Total execution time for static binding in millis: "
            + elapsedTime/1000000);
      //dynamic binding
      long startTime2 = System.nanoTime();
      pnt2.dynamic_display();
      long elapsedTime2 = System.nanoTime() - startTime2;

      System.out.println("Total execution time for dynamic binding in millis: "
            + elapsedTime2/1000000);
     }
    }
</code></pre>

<p>When this code is executed i am getting the following answer,</p>

<pre><code>    Static method called0times
    Total execution time for static binding in millis: 11
    dynamic method called0times
    Total execution time for dynamic binding in millis: 9
</code></pre>

<p>consider only the execution time in the result.i tried to find the time taken for statically and dynamically binnded method to execute.but according to my answer,dynamic binding is faster than static binding.how is this possible.am i wrong anywhere.</p>
