Get the maximum of three double values in Java
Description
The following code shows how to get the maximum of three double values.
Example
/*www.j av a 2 s. c om*/
public class Main {
public static double max(double a, double b, double c) {
return Math.max(Math.max(a, b), c);
}
public static void main(String[] argv){
System.out.println(max(1,2,3));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »