Find out the min value between two double in Java
Description
The following code shows how to find out the min value between two double.
Example
/*from ww w.j a va 2 s .co m*/
public class Main {
public static void main(String[] args) {
double enrollmentPrice = 45.875;
double closingPrice = 54.375;
System.out.println("Your purchase price is: $"
+ Math.min(enrollmentPrice, closingPrice));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »