1.

Convert string to date in Java

Answer»

The compare() method is USED in JAVA to compare two doubles.
Let us see an example:

import java.lang.*; PUBLIC class Example {    public STATIC void main(String args[]) {      Double val1 = new Double("488.11");      Double VAL2 = new Double("445.78");      int a =  Double.compare(val1, val2);      if(a > 0) {         System.out.println("Value 1 is greater than Value 2");      } else if(a < 0) {         System.out.println("Value 1 is less than Value 2");      } else {         System.out.println("Equal!");      }    } }

The output:

Value 1 is greater than Value 2


Discussion

No Comment Found