java.lang.Double.compare()


java.lang.Double.compare()

package com.codingdict;



import java.lang.*;



public class DoubleDemo {



   public static void main(String[] args) {



      // compares the two specified double values

      double d1 = 15.45;

      double d2 = 11.50;

      int retval = Double.compare(d1, d2);



      if(retval > 0) {

         System.out.println("d1 is greater than d2");

      } else if(retval < 0) {

        System.out.println("d1 is less than d2");

      } else {

         System.out.println("d1 is equal to d2");

      }

   }

}