Number Abs
# Java abs() Method
[Java Number Class](#)
* * *
abs() returns the absolute value of the parameter. The parameter can be of type int, float, long, double, short, or byte.
### Syntax
The method format for each type is similar to the following:
double abs(double d)float abs(float f)int abs(int i)long abs(long lng)
### Parameters
* Any primitive data type.
### Return Value
Returns the absolute value of the parameter.
### Example
## Example
public class Test{
public static void main(String args[]){
Integer a =-8;
double d =-100;
float f =-90f;
System.out.println(Math.abs(a));
System.out.println(Math.abs(d));
System.out.println(Math.abs(f));
}
}
Compile the above program, and the output will be:
8100.090.0
* * Java Number Class](#)
YouTip