Java StrictMath.abs(double a)
Syntax
StrictMath.abs(double a) has the following syntax.
public static double abs(double a)
Example
In the following code shows how to use StrictMath.abs(double a) method.
public class Main {
//www . ja v a 2 s . co m
public static void main(String[] args) {
double d1 = 1245.6 , d2 = -123.4;
System.out.println("absolute value of " + d1 + " = " + StrictMath.abs(d1));
System.out.println("absolute value of " + d2 + " = " + StrictMath.abs(d2));
}
}
The code above generates the following result.