Java Absolute ValueJava abs() methodJava standard class library includes an absolute value method, called abs(). Java abs() method is overloaded by Math class to handle all the primitive types. Java determines which version of the abs() method to call. It depends on the type of argument. In Java, we can find the absolute value by using the abs() method. It belongs to java.lang.Math class. It is an overloaded method. It returns the absolute value of an argument. The argument can be of any type such as int, float, double, long, and short. The signature of the method is: Where x is an argument whose absolute value is to be determined. Points to remember
ExampleOutput 9 3.14 9.5 Min value of integer is: -2147483648 Min value of long is: -922337203685477808 NaN Infinity
Next TopicJava Tutorial
|