math.absolute java code example
Example 1: abs in java
public class Test {
public static void main(String args[]) {
Integer a = -8;
double d = -100;
float f = -90;
System.out.println(Math.abs(a));
System.out.println(Math.abs(d));
System.out.println(Math.abs(f));
}
}
Example 2: math.absolute java
float a = 123.0f;
System.out.println(Math.abs(a));
double d = -999.3456;
System.out.println(Math.abs(d));
int e = -123;
System.out.println(Math.abs(g));
long g = -12345678;
System.out.println(Math.abs(g));