StrictMath.abs(int): This method is available in java.lang.StrictMath class of Java.
Syntax:
int java.lang.StrictMath.abs(int a)
This method takes one argument of type int as its parameter. This method returns the absolute value of an int value. If the argument is not negative, the argument is returned.If the argument is negative, the negation of the argument is returned.
Parameters: One parameter is required for this method.
a: the argument whose absolute value is to be determined.
Returns: the absolute value of the argument.
Exceptions: NA
Approach
Java
public class StrictMathabsint {public static void main(String[] args) {int a = -178;System.out.println(StrictMath.abs(a));}}
Output:
178
No comments:
Post a Comment